scanf

Performs formatted input from the standard input (stdin), interpreting it according to the format specification. See Chapter 2 for information on format specifiers.

Format

#include  <stdio.h>

int scanf  (const char *format_spec, . . . );

Arguments

format_spec
Characters to be taken literally from the input or converted and placed in memory at the specified input sources. For a list of conversion characters, see Chapter 2.
. . .
Optional expressions that are pointers to objects whose resultant types correspond to conversion specifications given in the format specification.

If no conversion specifications are given, you can omit these input pointers. Otherwise, the function call must have at least 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.

Return Values
The number of successfully matched and assigned input items. 
EOF  Indicates that a read error occurred prior to any successful conversions.The function sets errno. For a list of errno values set by this function, see fscanf in this section. 


Previous Page | Next Page | Table of Contents | Index