C examples for wchar.h:vfwprintf
function
<cwchar> <wchar.h>
Write formatted data from variable argument list to stream
int vfwprintf (FILE* stream, const wchar_t* format, va_list arg);
Parameter | Description |
---|---|
stream | Pointer to a FILE object |
format | a printf format string |
arg | a variable arguments list |
On success, the total number of characters written is returned.
On error, the error indicator (ferror) is set and a negative number is returned.
#include <stdio.h> #include <stdarg.h> #include <wchar.h> void WriteWideFormatted (FILE * stream, const wchar_t * format, ...) { va_list args;/*from ww w . ja va2s .c om*/ va_start (args, format); vfwprintf (stream, format, args); va_end (args); } int main () { FILE * pFile; pFile = fopen ("main.cpp","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; }