vprintf
Writes output to stdout under format control
#include <stdarg.h> #include <stdio.h> int vprintf ( const char *format, va_list arg);
The vprintf function returns the number of characters written or a negative value if an output error occurred. If an error occurs, errno is set.
The vprintf function writes output to the file stdout under control of the argument format. The format string is described under the description for printf. The vprintf function is equivalent to printf, with the variable argument list replaced with arg, which has been initialized by the va_start macro.
The following shows the use of vprintf in a general error message routine.
#include <stdarg.h> #include <stdio.h> void errmsg (char *format, ... ) { va_list arglist; printf ("Error: "); va_start (arglist, format); vprintf (format, arglist); va_end (arglist); }