vfwprintf - C wchar.h

C examples for wchar.h:vfwprintf

Type

function

From


<cwchar>
<wchar.h>

Description

Write formatted data from variable argument list to stream

Prototype

int vfwprintf (FILE* stream, const wchar_t* format, va_list arg);

Parameters

Parameter Description
stream Pointer to a FILE object
format a printf format string
arg a variable arguments list

Return Value

On success, the total number of characters written is returned.

On error, the error indicator (ferror) is set and a negative number is returned.

Demo Code


#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;
}

Related Tutorials