Node:Formatted Input Functions, Next:Variable Arguments Input, Previous:Other Input Conversions, Up:Formatted Input
Here are the descriptions of the functions for performing formatted
input.
Prototypes for these functions are in the header file stdio.h
.
int scanf (const char *template, ...) | Function |
The scanf function reads formatted input from the stream
stdin under the control of the template string template.
The optional arguments are pointers to the places which receive the
resulting values.
The return value is normally the number of successful assignments. If
an end-of-file condition is detected before any matches are performed,
including matches against whitespace and literal characters in the
template, then |
int wscanf (const wchar_t *template, ...) | Function |
The wscanf function reads formatted input from the stream
stdin under the control of the template string template.
The optional arguments are pointers to the places which receive the
resulting values.
The return value is normally the number of successful assignments. If
an end-of-file condition is detected before any matches are performed,
including matches against whitespace and literal characters in the
template, then |
int fscanf (FILE *stream, const char *template, ...) | Function |
This function is just like scanf , except that the input is read
from the stream stream instead of stdin .
|
int fwscanf (FILE *stream, const wchar_t *template, ...) | Function |
This function is just like wscanf , except that the input is read
from the stream stream instead of stdin .
|
int sscanf (const char *s, const char *template, ...) | Function |
This is like scanf , except that the characters are taken from the
null-terminated string s instead of from a stream. Reaching the
end of the string is treated as an end-of-file condition.
The behavior of this function is undefined if copying takes place
between objects that overlap--for example, if s is also given
as an argument to receive a string read under control of the |
int swscanf (const wchar_t *ws, const char *template, ...) | Function |
This is like wscanf , except that the characters are taken from the
null-terminated string ws instead of from a stream. Reaching the
end of the string is treated as an end-of-file condition.
The behavior of this function is undefined if copying takes place
between objects that overlap--for example, if ws is also given as
an argument to receive a string read under control of the |