std::scanf,std::fscanf,std::sscanf (3) - Linux Manuals
std::scanf,std::fscanf,std::sscanf: std::scanf,std::fscanf,std::sscanf
Command to display std::scanf,std::fscanf,std::sscanf
manual in Linux: $ man 3 std::scanf,std::fscanf,std::sscanf
NAME
std::scanf,std::fscanf,std::sscanf - std::scanf,std::fscanf,std::sscanf
Synopsis
Defined in header <cstdio>
int scanf( const char* format, ... ); (1)
int fscanf( std::FILE* stream, const char* format, ... ); (2)
int sscanf( const char* buffer, const char* format, ... ); (3)
Reads data from the a variety of sources, interprets it according to format and stores the results into given locations.
1) Reads the data from stdin
2) Reads the data from file stream stream
3) Reads the data from null-terminated character string buffer
Parameters
stream - input file stream to read from
buffer - pointer to a null-terminated character string to read from
pointer to a null-terminated character string specifying how to read the input.
The format string consists of
* non-whitespace multibyte characters except %: each such character in the format string consumes exactly one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal.
* whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling isspace in a loop). Note that there is no difference between "\n", " ", "\t\t", or other whitespace in the format string.
* conversion specifications. Each conversion specification has the following format:
* introductory % character
* (optional) assignment-suppressing character *. If this option is present, the function does not assign the result of the conversion to any receiving argument.
* (optional) integer number (greater than zero) that specifies maximum field width, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that %s and %[ may lead to buffer overflow if the width is not provided.
* (optional) length modifier that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below).
* conversion format specifier
The following format specifiers are available:
Conversion Explanation Argument type
specifier
length modifier hh h (none) l ll j z t L