English
Language : 

CC78K4 Datasheet, PDF (182/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 10 LIBRARY FUNCTIONS
4-2 sscanf
I/O Functions
FUNCTION
sscanf reads data from the input string according to the format.
HEADER
stdio.h
FUNCTION PROTOTYPE
int sscanf (const char *s, const char *format,...);
Function
sscanf
Arguments
s ... Pointer to the input string
format ... Pointer to the string
that indicates the input format
commands
... ... Pointer to object in which
converted values are to be
stored, and zero or more
arguments
Return Value
–1 if the string s is empty.
Number of assigned input data
items if the string s is not
empty.
EXPLANATION
• sscanf inputs data from the string pointed to by s. The string pointed to by format specifies the input string
allowed for input. Zero or more arguments after format are used as pointers to an object. format specifies
how data is to be converted from the input string.
• If there are insufficient arguments to match the format commands pointed to by format, proper operation by
the compiler is not guaranteed.
For excessive arguments, expression evaluation will be performed but no data will be input.
• The control string pointed to by format consists of zero or more format commands classified into the
following three types.
(1) White-space characters (one or more characters for which isspace becomes true)
(2) Non-white-space characters (other than %)
(3) Format specifiers
• Each format specifier begins with the % character and is followed by these:
• Optional * character which suppresses assignment of data to the corresponding argument
• Optional decimal integer which specifies a maximum field width
• Optional h, l or L modifier which indicates the object size on the receiving side
If h precedes the d, i, o, or x format specifier, the argument is a pointer to not int but short int.
If l precedes any of these format specifiers, the argument is a pointer to long int.
Likewise, if h precedes the u format specifier, the argument is a pointer to unsigned short int.
If l precedes the u format specifier, the argument is a pointer to unsigned long int.
• If l precedes the conversion specifier e, E, f, g, G, the argument is a pointer to double (a pointer to float
in default without l). If L precedes, it is ignored.
Remark Conversion specifier: Character to indicate the type of corresponding conversion (to be
described later)
182
User’s Manual U15556EJ1V0UM