Previous Page
Next Page

vfwprintf, vswprintf, vwprintf

Prints formatted wide-character output using a variable argument list object

#include <stdarg.h>
#include <wchar.h>
int vfwprintf ( FILE *fp , const wchar_t * restrict format , va_list argptr  );
int vswprintf ( wchar_t * restrict s , size_t n ,
               const wchar_t * restrict format , va_list argptr  );
int vwprintf ( const wchar_t * restrict format , va_list argptr  );

The functions vfwprintf( ), vswprintf( ), and vwprintf( ) are like fwprintf( ), swprintf( ), and wprintf( ), respectively, except that their last argument, argptr, is a variable-argument list object with type va_list. The program must initialize this object by calling the va_start( ) macro before calling the vfwprintf( ), vswprintf( ), or vwprintf( ) function, and must call the va_end( ) macro after the function returns. Because these functions use the va_arg( ) macro internally to advance the pointer through the argument list, its value is indeterminate after the vfwprintf( ), vswprintf( ), or vwprintf( ) function call has returned.

The vfwprintf( ) and vwprintf( ) functions return the number of wide characters written to the output stream, or a negative value if an error occurred. The vswprintf( ) function returns the number of wide characters written to the output buffer, not counting the terminating null wide character, or a negative value if an encoding error occurred or if the complete output string would have contained more than n wide characters.

Example

See the example for the corresponding byte-character function vfprintf( ) in this chapter.

See Also

vfwscanf( ), vswscanf( ), and vwscanf( )


Previous Page
Next Page