/* vfprintf example */ #include <stdio.h> #include <stdarg.h> #include <wchar.h> void WriteWideFormatted (FILE * stream, const wchar_t * format, ...) { va_list args; va_start (args, format); vfwprintf (stream, format, args); va_end (args); } int main () { FILE * pFile; pFile = fopen ("myfile.txt","w"); WriteWideFormatted (pFile,L"Call with %d variable argument.\n",1); WriteWideFormatted (pFile,L"Call with %d variable %ls.\n",2,L"arguments"); fclose (pFile); return 0; } |
myfile.txt |
Call with 1 variable argument. |
Call with 2 variable arguments. |
vfprintf | 将格式化的数据从变量参数列表写入流(function ) |
vwprintf | 将格式化的数据从变量参数列表打印到标准输出(function ) |
vswprintf | 将格式化的数据从变量参数列表写入特定大小的缓冲区(function ) |
fwprintf | 将格式化的数据写入流(function ) |
wprintf | 将格式化的数据打印到标准输出(function ) |