Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    int fscanf( FILE *fp, const char *format, ... );
    #include <stdio.h>
    #include <wchar.h>
    int fwscanf( FILE *fp, const wchar_t *format, ... );

Description:
    The fscanf function scans input from the file designated by fp under
    control of the argument format.  Following the format string is a list
    of addresses to receive values.  The format string is described under
    the description of the  scanf function.

    The fwscanf function is identical to fscanf except that it accepts a
    wide-character string argument for format.

Returns:
    The fscanf 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.  When a file input error occurs, the  errno global variable
    may be set.

Example:
    To scan a date in the form "Saturday April 18 1987":

    #include <stdio.h>

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

        in_data = fopen( "file", "r" );
        if( in_data != NULL ) {
          fscanf( in_data, "%s %s %d %d",
                  weekday, month, &day, &year );
          printf( "Weekday=%s Month=%s Day=%d Year=%d\n",
                  weekday, month, day, year );
          fclose( in_data );
        }
      }

Classification:
    fscanf is ANSI, fwscanf is ANSI

Systems:
     fscanf - All, Netware

    fwscanf - All

See Also:
    cscanf, scanf, sscanf, vcscanf, vfscanf, vscanf, vsscanf

See Also: cscanf vcscanf

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson