
IT Functionality 9-13
© 2005 HMS Industrial Networks.
AB7607 User manual
Between the “%” and the conversion character there may be the following modifi-
ers:
Modifier
Description
-
Specifies left adjustment of the converted argument in its field.
+
Specifies that the number will always be printed with a sign.
space
If the first character is not a sign, a space will be prefixed.
0
Specifies padding to the field with leading zeroes.
#
Specifies an alternate output form. For o, the first digit will be
zero. For x or X, 0x or 0X will be prefixed to a non-zero result.
For e, E, f, g and G, the output will always have a decimal point;
for g and G, trailing zeros will not be removed.
width
A number specifying a minimum field width. The converted
argument will be printed in a field at least this wide, and wider if
necessary. If the converted argument has fewer characters than
the field width it will be padded on the left (or right, if left
adjustment has been requested) to make up the field width. The
padding character is normally space, but can be 0 if the zero pad-
ding flag is present.
precision
A number, the precision, that specifies the maximum number of
characters to be printed from a string, or the number of digits to
be printed after the decimal point for e, E, or F conversions, or
the number of significant digits for g or G conversion, or the
minimum number of digits to be printed for an integer (leading
0s will be added to make up the necessary width)
.
A period, which separates the field width from the precision.
h
A length modifier. “h” Indicates that the corresponding argu-
ment is to be printed as a short or unsigned short.
l or L
A length modifier. “L” or “l” indicates that the argument is along
or unsigned long.
Table 9-1 printf Modifiers