Borland C++ reference

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

DOSUNIXWindowsANSI CC++ 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 formatcontained 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.specifierstring

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.