Export (0) Print
Expand All
Expand Minimize
0 out of 2 rated this helpful - Rate this topic

vprintf Functions

Each of the vprintf functions takes a pointer to an argument list, then formats and writes the given data to a particular destination.

Remarks

The vprintf functions are similar to their counterpart functions as listed in the following table. However, each vprintf function accepts a pointer to an argument list, whereas each of the counterpart functions accepts an argument list.

These functions format data for output to destinations as follows.

Function Counterpart function Output destination
vfprintf fprintf Stream
vfwprintf fwprintf Stream
vprintf printf Stdout
vwprintf wprintf Stdout
vsprintf sprintf memory pointed to by buffer
vswprintf swprintf memory pointed to by buffer
_vsnprintf _snprintf memory pointed to by buffer
_vsnwprintf _snwprintf memory pointed to by buffer
_vscprintf _vscprintf memory pointed to by buffer
_vscwprintf _vscwprintf memory pointed to by buffer

The argptr argument has type va_list, which is defined in VARARGS.H and STDARG.H. The argptr variable must be initialized by va_start, and may be reinitialized by subsequent va_arg calls; argptr then points to the beginning of a list of arguments that are converted and transmitted for output according to the corresponding specifications in the format argument. format has the same form and function as the format argument for printf. None of these functions invokes va_end. For a more complete description of each vprintf function, see the description of its counterpart function as listed in the preceding table.

_vsnprintf differs from vsprintf in that it writes no more than count bytes to buffer.

vfwprintf, _vsnwprintf, vswprintf, and vwprintf are wide-character versions of vfprintf, _vsnprintf, vsprintf, and vprintf, respectively; in each of these wide-character functions, buffer and format are wide-character strings. Otherwise, each wide-character function behaves identically to its SBCS counterpart function.

For vsprintf, vswprintf, _vsnprintf and _vsnwprintf, if copying occurs between strings that overlap, the behavior is undefined.

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

See Also

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.