Datasheet
570
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Description
The width field is a non-negative number that specifies the minimum number of
printed characters. If a number of characters in the output value is less than
width, then blanks are added on the left or right (when the - flag is specified) to
pad to the minimum width. If width is prefixed with 0, then zeros are padded
instead of blanks. The width field never truncates a field. If a length of the out-
put value exceeds the specified width, all characters are output.
The
precision field is a non-negative number that specifies a number of char-
acters 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.
flags
Meaning
-
Left justify the output in the specified field width.
+
Prefix the output value with + or - sign if the output is a signed type.
space (' ')
Prefix the output value with a blank if it is a signed positive
value. Otherwise, no blank is prefixed
#
Prefixes a non-zero output value with 0, 0x, or 0X when used with
o, x, and X field types, respectively. When used with e, E, f, g,
and G field types, the # flag forces the output value to include a
decimal point. The # flag is ignored in all other cases.
*
Ignore format specifier.
flags
Meaning of the precision field
d, u, o,
x, X
The precision field is where you specify a minimum number of dig-
its that will be included in the output value. Digits are not truncated
if the number of digits in the argument exceeds that defined in the
precision field. If a 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 a number of digits to the
right of the decimal point. The last digit is rounded.
e, E
The precision field is where you specify a number of digits to the
right of the decimal point. The last digit is rounded.
g
The precision field is where you specify a 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 a maximum number of
characters in the output value. Excess characters are not output.