#include <stdarg.h> #include <stdio.h> int vfprintf(FILE *f, const char *format, va_list arg);
vfprintf
is equivalent to fprintf
with arg
replacing the variable-argument list.
arg
has been initialized by the va_start
macro and possibly va_arg
calls. vfprintf
does not invoke the
va_end
macro. See va_arg
, va_end
, and va_start
for
details on varying-length argument-list functions.
vfprintf
returns the number of characters transmitted to the output
stream or a negative value if an output error occurs.
fprintf
and sends the remaining text with vfprintf
:
#include <stdarg.h> #include <stdio.h> void error(char *fname, char *format, ...) { va_list args; va_start(args, format); fprintf(stderr, "ERROR in %s: ", fname); vfprintf(stderr, format, args); va_end(args); }
fprintf
, va_start
, vprintf
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.