vfprintf
Writes output to a stream under format control
#include <stdarg.h> #include <stdio.h> int vfprintf ( FILE *fp, const char *format, va_list arg);
The vfprintf function returns the number of characters written or a negative value if an output error occurred. If an error occurs, errno is set.
The vfprintf function writes output to the file pointed to by fp under control of the argument format. The format string is described under the description for printf. The vfprintf function is equivalent to fprintf, with the variable argument list replaced with arg, which has been initialized by the va_start macro.
#include <stdarg.h> #include <stdio.h> extern FILE *LogFile; void errmsg /* A GENERAL ERROR ROUTINE */ (char *format, ... ) { va_list arglist; va_start (arglist, format); vfprintf (stderr, format, arglist); va_end (arglist ); if (LogFile != NULL) { va_start (arglist, format); vfprintf (LogFile, format, arglist); va_end (arglist); } }