Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-53
fprintf
•
Conversion Modifiers
Here are the possible values of modifier in a conversion specifier:
•
Conversion Codes
As mentioned earlier, conv_code determines both how fprintf interprets the
argument value and how it formats the value. This list shows the conversion codes
and describes the argument type and formatting specified by each code.
h
For conversion codes d, i, o, u, x, and X, the h modifier indicates that the value
is a short int, not an int. For conversion code n, the h modifier indicates that
the value is a pointer to short int, not a pointer to int.
l
For conversion codes d, i, o, u, x, and X, the l modifier indicates that the value
is a long int, not an int. For conversion code n, the l modifier indicates that the
value is a pointer to long int, not a pointer to int.
L
For conversion codes e, E, f, g, and G, the L modifier indicates that the value
is a long double, not a double. For conversion codes d, i, o, x, and X, the L
modifier indicates that the value is a long long, not an int.
c
formats an int argument as a single character, first converting the argument to
type unsigned int.
d
formats an int argument as a signed decimal integer
e
formats a double argument as a exponential number of the form [-]d.ddde±dd,
with one digit preceding the decimal point and precision digits following it. If
precision is zero, no decimal point is printed. If the conversion specifier
doesn’t include precision, six digits follow the decimal point. The value is
rounded to the specified number of decimal digits, and the exponent always
has at least two digits.
E
is equivalent to the e code, except that it prefixes the exponent with an
uppercase E rather than a lowercase one.
f
formats a double argument as a fixed-decimal number of the form [-]ddd.ddd,
with at least one digit preceding the decimal point and precision digits
following it. If precision is zero, no decimal point is printed. If the conversion
specifier doesn’t include precision, six digits follow the decimal point. The
value is rounded to the specified number of decimal digits.
g
formats a double argument using either the e code or the f code, depending
upon the value of the argument. The e code is used only if the exponent of the
converted value is less than or equal to -4, or if it is greater than or equal to the
precision. Trailing zeros are removed from the result, and a decimal point
appears only if it is followed by a digit.
G
is equivalent to the g code, except that it selects between the E code (not the e
code) and the f code.
i
is equivalent to d.