Definition | #include <stdio.h> int vfprintf(FILE *fp, const char *format, va_list arg);
| |
Return val. | Number of characters output | |
if successful. | ||
Integer< 0 | if an error occurs. | |
Notes |
The following applies in the case of text files with SAM access mode and variable record length for which a maximum record length is also specified: When the specification | |
Example | In the following program extract the #include <stdarg.h>
#include <stdio.h>
void error(char *f, ...);
int main(void)
{
.
.
char *weight = "WARNING";
int num = 20;
error("Error class: %s, Number: %d\n", weight, num);
.
.
error("No error\n");
.
.
}
void error(char *format, ...)
{
va_list arg;
va_start(arg, format);
vfprintf(stderr, format, arg);
va_end (arg);
}
| |
See also | vprintf, vsprintf, vsnprintf | |