HELPLIB.HLB  —  CRTL  fscanf
    Performs formatted input from a specified file, interpreting it
    according to the format specification.

    Format

      #include  <stdio.h>

      int fscanf  (FILE *file_ptr, const char *format_spec, . . . );

1  –  Arguments

 file_ptr

    A pointer to the file that provides input text.

 format_spec

    A pointer to a character string that contains the format
    specification.

  . . .

    Optional expressions whose results correspond to conversion
    specifications given in the format specification.

    If no conversion specifications are given, you can omit the input
    pointers. Otherwise, the function calls must have exactly as
    many input pointers as there are conversion specifications, and
    the conversion specifications must match the types of the input
    pointers.

    Conversion specifications are matched to input sources in left-
    to-right order. Excess input pointers, if any, are ignored.

2  –  Description

    An example of a conversion specification follows:

    #include <stdio.h>

    main ()
    {
       int   temp, temp2;

       fscanf(stdin, "%d %d", &temp, &temp2);
       printf("The answers are %d, and %d.", temp, temp2);
    }

    Consider a file, designated by stdin, with the following
    contents:

    4 17

    The example conversion specification produces the following
    result:

    The answers are 4, and 17.

3  –  Return Values

    x                  The number of successfully matched and
                       assigned input items.
    EOF                Indicates that the end-of-file was encountered
                       or a read error occurred. If a read error
                       occurs, the function sets errno to one of the
                       following:

                       o  EILSEQ - Invalid character detected.

                       o  EVMSERR - Nontranslatable OpenVMS error.
                          vaxc$errno contains the OpenVMS error code.
                          This can indicate that conversion to a
                          numeric value failed due to overflow.

                       The function can also set errno to the
                       following as a result of errors returned from
                       the I/O subsystem:

                       o  EBADF - The file descriptor is not valid.

                       o  EIO - I/O error.

                       o  ENXIO - Device does not exist.

                       o  EPIPE - Broken pipe.

                       o  EVMSERR - Nontranslatable OpenVMS error.
                          vaxc$errno contains the OpenVMS error code.
                          This indicates that an I/O error occurred
                          for which there is no equivalent C error
                          code.
Close Help