Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

fscanf - Formatted input from a file

&pagelevel(4)&pagelevel

Definition

#include <stdio.h>

int fscanf(FILE *fp, const char *format, argumentlist);

fscanf reads data (input fields) from a file with file pointer fp, converts this data according
to the specifications in the format string format, and stores the results in the areas that you
specify with the result pointers in the argument list.

fscanf works like scanf, except that the input fields are read from a file rather than the
standard input (stdin).

Parameters  FILE *fp

File pointer to the input file.

const char *format

Format string as described under scanf with KR or ANSI functionality (see relevant
section in scanf description)

argumentlist

Pointers to variables in which fscanf is to store the converted result.
No pointer arguments may be specified for %* statements (skip assignment) in format.
There must be one pointer argument each for all other % statements. The data type of
the pointer argument is determined by the type specification of the associated format
statement.

Return val.

Number of input fields read and successfully converted.

This does not include input fields for which %* (skip assignment) was
specified.

EOF

if an error occurred before the start of the conversions.

Note

See also

You will find detailed information, notes, and examples on formatted input under scanf.

scanf, sscanf