SSCANF definition and usage and analysis
The sscanf () function parses input from a string according to the specified format.
If only two parameters are passed to the function, the data is returned as an array. Otherwise, if additional parameters are passed, the parsed data is stored in these parameters. If the number of delimiters is greater than the number of variables that contain them, an error occurs. However, if the delimiter is less than the variable, the extra variable contains null.
Grammar
SSCANF (string,format,arg1,arg2,arg++) parameter description
string is required. Specifies the string to read.
Format required. Specifies the format to use.
Arg1 is optional. The first variable that stores the data.
Arg2 is optional. A second variable that stores data.
arg++ is optional. A third to fourth variable that stores data. And so on
Description
The parameters format is the converted format, starting with the percent sign ("%") to the end of the converted character. The following possible format values are:
Percent-return percentage symbol
%b-Binary number
%c-Characters in accordance with ASCII values
%d-Signed decimal number
%e-Sustainable counting method (e.g. 1.5e+3)
%u-Unsigned decimal number
%f-Floating point (Local settings Aware)
%f-Floating point number (not local settings aware)
%o-Eight binary number
%s-String
%x-16 binary number (lowercase letters)
%x-16 decimal digits (uppercase letters)
Example