fscanf function — Reads formatted data
int fscanf(FILE* stream, const char* format, . . . )
performs a formatted read from
format parameter contains formatting
information, and the remaining arguments are pointers. When
fscanf reads items, it stores their values
in the objects that successive arguments point to. The return value
is the number of items read or a negative value for an error.
Items are read from
and interpreted according to
format, which contains whitespace
characters, non-whitespace characters, and conversion
specifications, which begin with a percent sign (
%). A whitespace character directs
fscanf to skip over whitespace in
the input stream. Non-whitespace characters must match the input
text. Each conversion specification is made up of the following
parts (in order): assignment suppression, field width, size, and
The following are descriptions of the conversion specification elements:
An optional asterisk (
fscanf to read and parse the input
according to the conversion specification, but not to assign
the value to an argument.
An optional number (positive decimal integer) that specifies the maximum number of characters to read.
h means an integer is
l means an integer is
long; a floating-point number is
double, or a string
argument is a pointer to
wchar_t for the
[ conversion ...