English
Language : 

CC78K4 Datasheet, PDF (179/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 10 LIBRARY FUNCTIONS
sprintf
I/O Functions
• Optional h, l and L modifiers
The h modifier instructs the sprintf function to perform the d, i, o, u, x, or X type conversion that follows
this modifier on short int or unsigned short int type. The h modifier instructs the sprintf function to
perform the n type conversion that follows this modifier on a pointer to short int type.
The l modifier instructs the sprintf function to perform the d, i, o, u, x, or X type conversion that follows
this modifier on long int or unsigned long int type. The h modifier instructs the sprintf function to
perform the n type conversion that follows this modifier on a pointer to long int type.
For other type specifiers, the h, l or L modifier is ignored.
• Character that specifies the conversion (to be explained later)
In the minimum field width or precision (number of decimal places) specification, * may be used in place
of an integer string. In this case, the integer value will be given by the int argument (before the argument
to be converted). Any negative field width resulting from this will be interpreted as a positive field that
follows the − (minus) flag. All negative precision will be ignored.
The following flags are used to modify a format command.
– ................. The result of a conversion is left-justified within the field.
+ ................. The result of a signed conversion always begins with a + or − sign.
space.......... If the result of a signed conversion has no sign, a space is prefixed to the output. If the +
(plus) flag and space flag are specified at the same time, the space flag will be ignored.
# ................. The result is converted in the assignment form.
In the o type conversion, precision is increased so that the first digit becomes 0. In the x or X
type conversion, 0x or 0X is prefixed to a nonzero result. In the e, E, and f type conversions,
a decimal point is forcibly inserted to all the output values (in the default without #, a decimal
point is displayed only when there is a value to follow).
In the g and G type conversions, a decimal point is forcibly inserted to all the output values,
and truncation of 0 to follow will not be allowed (in the default without #, a decimal point is
displayed only when there is a value to follow. The 0 to follow will be truncated). In all the
other conversions, the # flag is ignored.
The format codes for output conversion specifications are as follows.
d ................. Converts int argument to signed decimal format.
i .................. Converts int argument to signed decimal format.
o ................. Converts int argument to unsigned octal format.
u ................. Converts int argument to unsigned decimal format.
x ................. Converts int argument to unsigned hexadecimal format (with lowercase letters abcdef).
X ................. Converts int argument to unsigned hexadecimal format (with uppercase letters ABCDEF).
With d, i, o, u, x and X type specifiers, the minimum number of digits (minimum field width) of the result is
specified. If the output is shorter than the minimum field width, it is padded with zeros. If no precision is
specified, 1 is assumed to have been specified. Nothing will appear if 0 is converted with 0 precision.
User’s Manual U15556EJ1V0UM
179