[Previous]
[Contents]
[Next]

vfscanf()

scan input from a file

Synopsis:

#include <stdio.h>
#include <stdarg.h>

int vfscanf( FILE *fp,
             const char *format,
             va_list arg );

Description:

The vfscanf() function scans input from the file designated by fp, under control of the argument format. The format string is described under the description of the scanf() function.

The vfscanf() function is equivalent to the fscanf() function, with a variable argument list replaced with arg, which has been initialized using the va_start() macro.

Returns:

EOF when the scanning is terminated by reaching the end of the input stream. Otherwise, the number of input arguments for which values were successfully scanned and stored is returned. When a file input error occurs, the errno global variable may be set.

Examples:

#include <stdio.h>
#include <stdarg.h>

void ffind( FILE *fp, char *format, ... )
  {
    va_list arglist;

    va_start( arglist, format );
    vfscanf( fp, format, arglist );
    va_end( arglist );
  }

void main()
  {
    int day, year;
    char weekday[10], month[12];

    ffind( stdin,
        "%s %s %d %d",
        weekday, month, &day, &year );
    printf( "\n%s, %s %d, %d\n",
        weekday, month, day, year );
  }

Classification:

WATCOM

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

cscanf(), errno, fscanf(), scanf(), sscanf(), va_arg(), va_end(), va_start(), vcscanf(), vscanf(), vsscanf()


[Previous]
[Contents]
[Next]