Mikroelektronika MIKROE-738 Datenbogen
mikroC PRO for PIC32
MikroElektronika
651
Parameters The
precision
field is a non-negative number that specifies a number of characters to print, number
of significant digits or number of decimal places. The precision field can cause truncation or rounding
of the output value in the case of a floating-point number as specified in the following table.
The optional characters
l
or
L
may immediately precede
conversion_type
to respectively specify
long versions of the integer types
d, i, u, o, x,
and
X.
You must ensure that the argument type matches that of the format specification. You can use type
casts to ensure that the proper type is passed to
sprintf
.
flags
Meaning of the
precision
field
d, u, o, x, X
The precision field is where you specify the minimum number of digits that will
be included in the output value. Digits are not truncated if the number of digits
in an argument exceeds that defined in the precision field. If the number of
digits in the argument is less than the precision field, the output value is padded
on the left with zeros.
f
The precision field is where you specify the number of digits to the right of the
decimal point. The last digit is rounded.
e, E
The precision field is where you specify the number of digits to the right of the
decimal point. The last digit is rounded.
g
The precision field is where you specify the maximum number of significant
digits in the output value.
c, C
The precision field has no effect on these field types.
s
The precision field is where you specify the maximum number of characters in
the output value. Excess characters are not output.
sprintl
Prototype
void sprintl(char *wh, const code char *f,...);
Returns
The function returns the number of characters actually written to destination string.
Description The same as sprintf, except it doesn’t support float-type numbers.
sprinti
Prototype
void sprinti(char *wh, const code char *f,...);
Returns
The function returns the number of characters actually written to destination string.
Description The same as sprintf, except it doesn’t support long integers and float-type numbers.