vfprintf
raw OCR
Writes formatted output to a stream.
Defined in header <stdio.h>
Syntax
#include <stdio.h>
int vfprintf(FILE *stream, const char *format, vajist arglist);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
Available on UNIX System V.
The v...printf functions are known as alternate entry points for the ...printf functions. They behave exactly like their ...printf counterparts, but they accept a pointer to a list of arguments instead of an argument list.
See printf for details
vfprintf accepts a pointer to a series of arguments, applies to each
on format specifiers.
| a format | contained in the format | |
| argument pointed to by format, and outputs the formatted data to a stream. There must be the same number of format specifiers as arguments. | specifier | string |
Return value
vfprintf returns the number of bytes output. In the event of error, vfprintf returns EOF.
See also
Example
#include <stdio.h>
#include <stdlib.h>
FILE *fp;
int vfpf(char *fmt, ...)
{
va_list argptr;
int cnt;
va_start (argptr, fmt);
cnt = vfprintf (fp, fmt, argptr);
va_end(argptr) ;
return (cnt);
int main (void)
{
int inumber =30;
float fnumber = 90.0;
char string [4] = "abc";
fp = tmpfileO ;
if (fp == NULL) {
perror( "tmpfileO call"
exit(l);
vfpf("%d %f %s", inumber, fnumber, string);
rewind(fp);
fscanf (fp,"%d %f %s", &inumber, &fnumber, string)
printf ("%d %f %s\n", inumber, fnumber, string);
fclose (fp);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdio.h/vfprintf/
· short form /3.1/vfprintf/