- 5
- 0
- 约1.86万字
- 约 26页
- 2017-06-05 发布于河南
- 举报
printf()详解(国外英文资料)
printf()详解
Format I/O function family
The function family use can be used for all the flow only for strings in stdin and stdout memory
Scanf format input fscanf scanf sscanf
Printf format the output fprintf printf sprintf
2 the scanf family of functions
FILE * stream, const char * format,... ;
Int scanf (const char * format,...) ;
Int sscanf (const char * string, const char * format,...) ;
When the formatting string arrives at the end or the input that reads does not match the type specified by the format string, the input stops.
The number of input values of the transformation is returned as the return value.
If the input stream reaches the tail before any input values are converted, the function returns EOF.
The format string parameter in the scanf family may contain the following:
Blank characters - they match zero or more blank characters in the input and are ignored during processing.
Format code - they specify how the function interprets the following input characters.
Other characters - when any other character appears in the format string, the next input character must match it.
If the match is matched, the input character is then discarded. If it doesnt match, the function doesnt read the return directly.
3 the scanf format code
Format: %
[width] [qualifier] format code
The [] is an option.
1 *
The asterisk indicates that the converted value will be discarded rather than stored.
2 width
The width is given by a non-negative integer, which limits the number of input characters that will be read for the transformation.
If the width is not given, the function continues to read the characters until they meet the next blank character in the input.
3 qualifiers
Qualifiers are used to modify the meaning of some format code:
Form code h l l
D, I, n short long
O, u, x unsigned short unsigned long
E, f, g double long double
4 format codes
The format code is used to specify how characters are interpreted:
C code
Parameters of char *
Meaning reads and stores individ
原创力文档

文档评论(0)