Name
vfprintf function — Writes formatted data
Synopsis
#include <cstdarg>
int vfprintf(FILE* stream, const char* format, va_list arg)
The vfprintf
function is
like fprintf
, but the values to
print are taken from successive arguments in arg
(obtained by calling va_start(arg
,
param
)
). Use vfprintf
to write your own fprintf
-like function.
Example
The following shows how you can implement fprintf
in terms of vfprintf
:
int fprintf(std::FILE* stream, const char* format, . . . ) { std::va_list ap; va_start(ap, format); int result = vfprintf(stream, format, ap); va_end(ap); return result; }
See Also
fprintf function,
vfwprintf
in <cwchar>
, <cstdarg>
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.