HP C/iX Library Reference Manual (30026-90004)
Chapter 5 273
HP C/iX Library Function Descriptions
printf
leading zeros. The default
precision
is 1. A null string results if a zero
value is printed with a zero
precision
. The # flag has no effect.
u An integer
item
is converted to unsigned decimal. The effects of the
precision
and the # flag are the same as for d.
o An integer
item
is converted to unsigned octal. The # flag, if specified,
causes the
precision
to be expanded, and the octal value is printed with a
leading zero (a C convention). The
precision
behaves the same as in d
above, except that printing a zero value with a zero
precision
results in
only the leading zero being printed, if the # flag is specified.
x An integer
item
is converted to hexadecimal. The letters abcdef are used
in printing hexadecimal values. The # flag, if specified, causes the
precision
to be expanded, and the hexadecimal value is printed with a
leading "0x" (a C convention). The
precision
behaves as in d above,
except that printing a zero value with a zero
precision
results in only the
leading "0x" being printed, if the # flag is specified.
X Same as x above, except that the letters ABCDEF are used to print the
hexadecimal value, and the # flag causes the value to be printed with a
leading "0X".
The character conversion characters are as follows:
c The character specified by the char
item
is printed. The
precision
is
meaningless, and the # flag has no effect.
s The string pointed to by the character pointer
item
is printed. If a
precision
is specified, characters from the string are printed until the
number of characters indicated by the
precision
is reached, or until a
null character is encountered, whichever comes first. If the
precision
is
omitted, all characters up to the first null character are printed. The # flag
has no effect.
The floating-point conversion characters are:
f The float or double
item
is converted to decimal notation in style f; that
is, in the form
[-]ddd.ddd
where the number of digits after the decimal point is equal to the
precision
. If
precision
is not specified, six digits are printed after the
decimal point. If the
precision
is explicitly zero, the decimal point is
eliminated entirely. If the # flag is specified, a decimal point always
appears, even if no digits follow the decimal point.
e The float or double
item
is converted to scientific notation in style e;
that is, in the form
[-]d.ddde±ddd
where there is always one digit before the decimal point. The number of
digits after the decimal point is equal to the
precision
. If
precision
is
not given, six digits are printed after the decimal point. If the
precision
is explicitly zero, the decimal point is eliminated entirely. The exponent