vfscanf

Scans input from a stream under format control

Local Servers:blocking
Remote Servers:blocking
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
  #include <stdarg.h>  
   
  int  vfscanf  (  
     FILE         *fp,   
     const char   *format,   
     va_list       arg);
  

Parameters

fp
(IN) Points to the file.
format
(IN) Points to the format control string.
arg
(OUT) Specifies a variable argument.

Return Values

The vfscanf function 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. If a file input error occurs, errno is set.

Remarks

The vfscanf function scans input from the file designated by fp under control of the argument format. The format list is described with 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.

See Also

fscanf, scanf, sscanf, va_arg, va_end, va_start (NDK: Program Management)

vfscanf Example

  #include <stdio.h>  
   
  #include <stdarg.h>  
  main ()  
  {  
     auto va_list arglist;  
     va_start (arglist, arg);  
     vfprintf (fp, format, arglist);  
     va_end (arglist);  
  }