English
Language : 

CC78K4 Datasheet, PDF (183/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 10 LIBRARY FUNCTIONS
sscanf
I/O Functions
• sscanf executes the format commands in “format” in sequence and if any format command fails, the function
will terminate.
(1) A white-space character in the control string causes sscanf to read any number (including zero) of
white-space characters up to the first non-white-space character (which will not be read). This white-
space character command fails if it does not encounter any non-white-space characters.
(2) A non-white-space character causes sscanf to read and discard a matching character. This command
fails if the specified character is not found.
(3) The format commands define a collection of input streams for each type specifier (to be detailed later).
The format commands are executed according to the following steps.
• The input white-space characters (specified by isspace) are skipped over, except when the type
specifier is [, c, or n.
• The input data items are read from the string “s”, except when the type specifier is n. The input data
items are defined as the longest input stream of the first partial stream of the string indicated by the
type specifier (but up to the maximum field width if so specified). The character next to the input data
items is interpreted as not have been read. If the length of the input data items is 0, the format
command execution fails.
• The input data items (number of input characters with the type specifier n) are converted to the type
specified by the type specifier except the type specifier %. If the input data items do not match the
specified type, the command execution fails. Unless assignment is suppressed by *, the result of the
conversion is stored in the object pointed to by the first argument that follows “format” and has not yet
received the result of the conversion.
• The following type specifiers are available.
d....................... Reads a decimal integer (which may be signed). The corresponding argument must be a
pointer to an integer.
i ........................ Reads an integer (which may be signed). If a number is preceded by 0x or 0X, the number
is interpreted as a hexadecimal integer. If a number is preceded by 0, the number is
interpreted as an octal integer. Other numbers are regarded as decimal integers. The
corresponding argument must be a pointer to an integer.
o....................... Reads an octal integer (which may be signed). The corresponding argument must be a
pointer to an integer.
u....................... Reads an unsigned decimal integer.
The corresponding argument must be a pointer to an unsigned integer.
x ....................... Reads a hexadecimal integer (which may be signed).
e, E, F, g, G...... A floating-point value consists of an optional sign (+ or –), one or more consecutive
decimal number(s) including a decimal point, an optional exponent (e or E), and the
following optional signed integer value. When overflow occurs as a result of conversion, or
when underflow occurs with the conversion result ±∞, a non-normalized number or ±0
becomes the conversion result. The corresponding argument is a pointer to float. The
corresponding argument must be a pointer to the first character of an array that has
sufficient size to accommodate this character string and a null terminator. The null
terminator will be automatically added.
User’s Manual U15556EJ1V0UM
183