HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
f
fwprintf(3C) fwprintf(3C)
appear in that order before the argument, if any, to be converted. A negative field width is taken as a
-
flag followed by a positive field width. A negative precision is taken as if the precision were omitted. In
format wide-character strings containing the
%n$ form of a conversion specification, a field width or pre-
cision may be indicated by the sequence
%
n$, where m is a decimal integer in the range [1,
{NL_ARGMAX}] giving the position in the argument list (after the format argument) of an integer argu-
ment containing the field width or precision , for example:
wprintf(L"%1$d:%2$. *3$d:%4$, *3$d\n", hour, min, precision, sec);
The format can contain either numbered argument specifications (that is,
%n$ and *m$), or unnumbered
argument specifications (that is,
% and
*), but normally not both. The only exception to this is that %%
can be mixed with the %n
$ form. The results of mixing numbered and unnumbered argument
specifications in a format wide-character string are undefined. When numbered argument specifications
are used, specifying the Nth argument requires that all the leading arguments, from the first to the (N-
1)th, are specified in the format wide-character string.
The flag wide-characters and their meanings are:
’ The integer portion of the result of a decimal conversion (%i, %d, %u, %g, or %G ) will be
formatted with thousands’ grouping wide-characters. For other conversions the behavior
is undefined. The non-monetary grouping wide-character is used.
- The result of the conversion will be left-justified within the field. The conversion will be
right-justified if this flag is not specified.
+ The result of a signed conversion will always begin with a sign (+ or -). The conversion
will begin with a sign only when a negative value is converted if this flag is not specified.
space If the first wide-character of a signed conversion is not a sign or if a signed conversion
results in no wide-characters, a space will be prefixed to the result. This means that if
the space and + flags both appear, the space flag will be ignored.
# This flag specifies that the value is to be converted to an alternative form. For
o conver-
sion, it increases the precision (if necessary) to force the first digit of the result to be 0.
For
x or X conversions, a non-zero result will have 0x (or 0X) prefixed to it. For
e, E, f,
g or G conversions, the result will always contain a radix character, even if no digits fol-
low it. Without this flag, a radix character appears in the result of these conversions only
if a digit follows it. For g and G conversions, trailing zeros will not be removed from the
result as they normally are. For other conversions, the behavior is undefined.
0 For d, i, o, u, x, X, e
, E, f, g and G conversions, leading zeros (following any indication
of sign or base) are used to pad to the field width; no space padding is performed. If the
0 and - flags both appear, the 0 flag will be ignored. For
d, i, o, u, x and X conversions,
if a precision is specified, the
0 flag will be ignored. If the
0 and i flags both appear, the
grouping wide-characters are inserted before zero padding. For other conversions, the
behavior is undefined.
The conversion wide-characters and their meanings are:
d,i The int argument is converted to a signed decimal in the style [-]dddd. The precision
specifies the minimum number of digits to appear; if the value being converted can be
represented in fewer digits, it will be expanded with leading zeros. The default precision
is 1. The result of converting 0 with an explicit precision of 0 is no wide-characters.
o The unsigned int argument is converted to unsigned octal format in the style dddd. The
precision specifies the minimum number of digits to appear; if the value being converted
can be represented in fewer digits, it will be expanded with leading zeros. The default
precision is 1. The result of converting 0 with an explicit precision of 0 is no wide-
characters.
u The unsigned int argument is converted to unsigned decimal format in the style dddd.
The precision specifies the minimum number of digits to appear; if the value being con-
verted can be represented in fewer digits, it will be expanded with leading zeros. The
default precision is 1. The result of converting 0 with an explicit precision of 0 is no
wide-characters.
x The unsigned int argument is converted to unsigned hexadecimal format in the style IR
dddd ; the letters abcdef are used. The precision specifies the minimum number of digits
to appear; if the value being converted can be represented in fewer digits, it will be
Section 3−−348 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: September 2004