vfprintf, vfwprintf
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

vfprintf, vfwprintf

Write formatted output using a pointer to a list of arguments.

int vfprintf(
   FILE *stream,
   const char *format,
   va_list argptr 
int vfwprintf(
   FILE *stream,
   const wchar_t *format,
   va_list argptr 


Pointer to FILE structure.
Format specification.
Pointer to list of arguments.

For more information, see Format Specifications.

Return Value

vfprintf and vfwprintf return the number of characters written, not including the terminating null character, or a negative value if an output error occurs.


Each of these functions takes a pointer to an argument list, then formats and writes the given data to stream.

Security Note   Ensure that format is not a user-defined string. For more information, see Avoiding Buffer Overruns.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_vftprintf vfprintf vfprintf vfwprintf


Routine Required header Optional headers Compatibility
vfprintf <stdio.h> and <stdarg.h> <varargs.h>* ANSI, Win 95
vfwprintf <stdio.h> or <wchar.h>, and <stdarg.h> <varargs.h>* ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

* Required for UNIX V compatibility.

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

Stream I/O Routines | vprintf Functions Overview | fprintf | printf | sprintf | va_arg | Run-Time Routines and .NET Framework Equivalents

© 2015 Microsoft