
35
interprets as addresses of C variables, and reads character strings,
representing their values. It converts them to their internal
representations using formatting commands embedded in the
argument
format_string
, which must be present in a call to
_scanf
.
The interpretation of the variables depends on the
format_string
. The
formatting command for each variable begins with a % sign and can
contain other characters as well. A whitespace character (a blank
space, a tab, or a new line) may cause
_scanf
to ignore whitespace
characters from keyboard. Other nonwhitespace characters,
excluding the % sign, cause
_scanf
to ignore each matching character
from the input. It begins to interpret the first nonmatching character
as the value of variable that is being read.
For each C variable whose address is included in the argument list to
_scanf
, there must be a format specification embedded in the
format_string
. For the complete format specification accepted by the
_scanf
function, please refer to the
scanf
function in Turbo C++.
If you want input a float value, the value type is “ double “, not
“ float “.
Returns
:
The
_scanf
function returns the number of input items that were
successfully read, converted, and saved in variables. A return value
equal to EOF means that an end-of-file was encountered during the
read operation.
_scanf_Num
Purpose
:
Use
_scanf_Num
to read character strings(only for number 0~9) from
the standard input file
stdin
and covert the strings to values of C
variables according to specified formats.
Syntax
:
int _scanf_Num(const char *format_string, …);
Example call
:
_scanf_Num (“ %d:%d:%d”, &hour, &minute, &second);
Includes
:
#include
“
UserLib.h
"
Description
:
The
_scanf_Num
function accepts a variable number(Only 0 to 9) of
arguments, which it interprets as addresses of C variables, and reads
character strings, representing their values. It converts them to their
internal representations using formatting commands embedded in the
argument
format_string
, which must be present in a call to
_scanf_Num
.
The interpretation of the variables depends on the
format_string
. The
formatting command for each variable begins with a % sign and can
contain other characters as well. A whitespace character (a blank
Содержание PT-10
Страница 4: ...3 Keyboard Wedge 99 System 101 Power 102 Other 102 ...
Страница 13: ...12 6 Development Flow Chart ...
Страница 53: ...52 Returns No returns Notes ...