|
Packit |
7cfc04 |
'\" et
|
|
Packit |
7cfc04 |
.TH FWPRINTF "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH PROLOG
|
|
Packit |
7cfc04 |
This manual page is part of the POSIX Programmer's Manual.
|
|
Packit |
7cfc04 |
The Linux implementation of this interface may differ (consult
|
|
Packit |
7cfc04 |
the corresponding Linux manual page for details of Linux behavior),
|
|
Packit |
7cfc04 |
or the interface may not be implemented on Linux.
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
fwprintf,
|
|
Packit |
7cfc04 |
swprintf,
|
|
Packit |
7cfc04 |
wprintf
|
|
Packit |
7cfc04 |
\(em print formatted wide-character output
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
#include <stdio.h>
|
|
Packit |
7cfc04 |
#include <wchar.h>
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
int fwprintf(FILE *restrict \fIstream\fP, const wchar_t *restrict \fIformat\fP, ...);
|
|
Packit |
7cfc04 |
int swprintf(wchar_t *restrict \fIws\fP, size_t \fIn\fP,
|
|
Packit |
7cfc04 |
const wchar_t *restrict \fIformat\fP, ...);
|
|
Packit |
7cfc04 |
int wprintf(const wchar_t *restrict \fIformat\fP, ...);
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The functionality described on this reference page is aligned with the
|
|
Packit |
7cfc04 |
ISO\ C standard. Any conflict between the requirements described here and the
|
|
Packit |
7cfc04 |
ISO\ C standard is unintentional. This volume of POSIX.1\(hy2008 defers to the ISO\ C standard.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
function shall place output on the named output
|
|
Packit |
7cfc04 |
.IR stream .
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIwprintf\fR()
|
|
Packit |
7cfc04 |
function shall place output on the standard output stream
|
|
Packit |
7cfc04 |
.IR stdout .
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIswprintf\fR()
|
|
Packit |
7cfc04 |
function shall place output followed by the null wide character in
|
|
Packit |
7cfc04 |
consecutive wide characters starting at *\fIws\fP; no more than
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
wide characters shall be written, including a terminating null wide
|
|
Packit |
7cfc04 |
character, which is always added (unless
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
is zero).
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Each of these functions shall convert, format, and print its arguments
|
|
Packit |
7cfc04 |
under control of the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character string. The
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
is composed of zero or more directives:
|
|
Packit |
7cfc04 |
.IR "ordinary wide-characters" ,
|
|
Packit |
7cfc04 |
which are simply copied to the output stream, and
|
|
Packit |
7cfc04 |
.IR "conversion specifications" ,
|
|
Packit |
7cfc04 |
each of which results in the fetching of zero or more arguments. The
|
|
Packit |
7cfc04 |
results are undefined if there are insufficient arguments for the
|
|
Packit |
7cfc04 |
.IR format .
|
|
Packit |
7cfc04 |
If the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
is exhausted while arguments remain, the excess arguments are evaluated
|
|
Packit |
7cfc04 |
but are otherwise ignored.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Conversions can be applied to the
|
|
Packit |
7cfc04 |
.IR n th
|
|
Packit |
7cfc04 |
argument after the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
in the argument list, rather than to the next unused argument. In this
|
|
Packit |
7cfc04 |
case, the conversion specifier wide character
|
|
Packit |
7cfc04 |
.BR %
|
|
Packit |
7cfc04 |
(see below) is replaced by the
|
|
Packit |
7cfc04 |
sequence
|
|
Packit |
7cfc04 |
.BR \(dq%n$\(dq ,
|
|
Packit |
7cfc04 |
where
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
is a decimal integer in the range [1,{NL_ARGMAX}],
|
|
Packit |
7cfc04 |
giving the position of the argument in the argument list. This feature
|
|
Packit |
7cfc04 |
provides for the definition of
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character strings that select arguments in an order appropriate to
|
|
Packit |
7cfc04 |
specific languages (see the EXAMPLES section).
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
can contain either numbered argument specifications (that is,
|
|
Packit |
7cfc04 |
\fR"%\fIn\fR$"\fR and \fR"*\fIm\fR$"\fR), or unnumbered argument
|
|
Packit |
7cfc04 |
conversion specifications (that is,
|
|
Packit |
7cfc04 |
.BR %
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR * ),
|
|
Packit |
7cfc04 |
but not both. The only exception to this is that
|
|
Packit |
7cfc04 |
.BR %%
|
|
Packit |
7cfc04 |
can be mixed with the \fR"%\fIn\fR$"\fR form. The results of mixing
|
|
Packit |
7cfc04 |
numbered and unnumbered argument specifications in a
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character string are undefined. When numbered argument
|
|
Packit |
7cfc04 |
specifications are used, specifying the
|
|
Packit |
7cfc04 |
.IR N th
|
|
Packit |
7cfc04 |
argument requires that all the leading arguments, from the first to the
|
|
Packit |
7cfc04 |
(\fIN\fP\(mi1)th, are specified in the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character string.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character strings containing the \fR"%\fIn\fR$"\fR form of
|
|
Packit |
7cfc04 |
conversion specification, numbered arguments in the argument list can
|
|
Packit |
7cfc04 |
be referenced from the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character string as many times as required.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character strings containing the
|
|
Packit |
7cfc04 |
.BR %
|
|
Packit |
7cfc04 |
form of conversion specification, each argument in the argument list
|
|
Packit |
7cfc04 |
shall be used exactly once.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
All forms of the
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
function allow for the insertion of a locale-dependent radix
|
|
Packit |
7cfc04 |
character in the output string, output as a wide-character value. The
|
|
Packit |
7cfc04 |
radix character is defined in the current locale (category
|
|
Packit |
7cfc04 |
.IR LC_NUMERIC ).
|
|
Packit |
7cfc04 |
In the POSIX locale, or in a locale where the radix character is not
|
|
Packit |
7cfc04 |
defined, the radix character shall default to a
|
|
Packit |
7cfc04 |
<period>
|
|
Packit |
7cfc04 |
(\c
|
|
Packit |
7cfc04 |
.BR '.' ).
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Each conversion specification is introduced by the
|
|
Packit |
7cfc04 |
.BR '%'
|
|
Packit |
7cfc04 |
wide character
|
|
Packit |
7cfc04 |
or by the wide-character sequence \fR"%\fIn\fR$"\fR,
|
|
Packit |
7cfc04 |
after which the following appear in sequence:
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
Zero or more
|
|
Packit |
7cfc04 |
.IR flags
|
|
Packit |
7cfc04 |
(in any order), which modify the meaning of the conversion
|
|
Packit |
7cfc04 |
specification.
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
An optional minimum
|
|
Packit |
7cfc04 |
.IR "field width" .
|
|
Packit |
7cfc04 |
If the converted value has fewer wide characters than the field width,
|
|
Packit |
7cfc04 |
it shall be padded with
|
|
Packit |
7cfc04 |
<space>
|
|
Packit |
7cfc04 |
characters by default on the left; it shall be padded on the right,
|
|
Packit |
7cfc04 |
if the left-adjustment flag (\c
|
|
Packit |
7cfc04 |
.BR '\(mi' ),
|
|
Packit |
7cfc04 |
described below, is given to the field width. The field width takes the
|
|
Packit |
7cfc04 |
form of an
|
|
Packit |
7cfc04 |
<asterisk>
|
|
Packit |
7cfc04 |
(\c
|
|
Packit |
7cfc04 |
.BR '*' ),
|
|
Packit |
7cfc04 |
described below, or a decimal integer.
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
An optional
|
|
Packit |
7cfc04 |
.IR precision
|
|
Packit |
7cfc04 |
that gives the minimum number of digits to appear for the
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifiers; the number of digits to appear after the radix
|
|
Packit |
7cfc04 |
character for the
|
|
Packit |
7cfc04 |
.BR a ,
|
|
Packit |
7cfc04 |
.BR A ,
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
conversion specifiers; the maximum number of significant digits for the
|
|
Packit |
7cfc04 |
.BR g
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifiers; or the maximum number of wide characters to be
|
|
Packit |
7cfc04 |
printed from a string in the
|
|
Packit |
7cfc04 |
.BR s
|
|
Packit |
7cfc04 |
conversion specifiers. The precision takes the form of a
|
|
Packit |
7cfc04 |
<period>
|
|
Packit |
7cfc04 |
(\c
|
|
Packit |
7cfc04 |
.BR '.' )
|
|
Packit |
7cfc04 |
followed either by an
|
|
Packit |
7cfc04 |
<asterisk>
|
|
Packit |
7cfc04 |
(\c
|
|
Packit |
7cfc04 |
.BR '*' ),
|
|
Packit |
7cfc04 |
described below, or an optional decimal digit string, where a null
|
|
Packit |
7cfc04 |
digit string is treated as 0. If a precision appears with any other
|
|
Packit |
7cfc04 |
conversion wide character, the behavior is undefined.
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
An optional length modifier that specifies the size of the argument.
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.IR "conversion specifier"
|
|
Packit |
7cfc04 |
wide character that indicates the type of conversion to be applied.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
A field width, or precision, or both, may be indicated by an
|
|
Packit |
7cfc04 |
<asterisk>
|
|
Packit |
7cfc04 |
(\c
|
|
Packit |
7cfc04 |
.BR '*' ).
|
|
Packit |
7cfc04 |
In this case an argument of type
|
|
Packit |
7cfc04 |
.BR int
|
|
Packit |
7cfc04 |
supplies the field width or precision. Applications shall ensure that
|
|
Packit |
7cfc04 |
arguments specifying field width, or precision, or both appear in that
|
|
Packit |
7cfc04 |
order before the argument, if any, to be converted. A negative field
|
|
Packit |
7cfc04 |
width is taken as a
|
|
Packit |
7cfc04 |
.BR '\(mi'
|
|
Packit |
7cfc04 |
flag followed by a positive field width. A negative precision is taken
|
|
Packit |
7cfc04 |
as if the precision were omitted.
|
|
Packit |
7cfc04 |
In
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
wide-character strings containing the \fR"%\fIn\fR$"\fR form
|
|
Packit |
7cfc04 |
of a conversion specification, a field width or precision may be
|
|
Packit |
7cfc04 |
indicated by the sequence \fR"*\fIm\fR$"\fR, where
|
|
Packit |
7cfc04 |
.IR m
|
|
Packit |
7cfc04 |
is a decimal integer in the range [1,{NL_ARGMAX}] giving the position
|
|
Packit |
7cfc04 |
in the argument list (after the
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
argument) of an integer argument containing the field width or
|
|
Packit |
7cfc04 |
precision, for example:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
wprintf(L"%1$d:%2$.*3$d:%4$.*3$d\en", hour, min, precision, sec); \*?
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The flag wide characters and their meanings are:
|
|
Packit |
7cfc04 |
.IP "\fR'\fR" 8
|
|
Packit |
7cfc04 |
(The
|
|
Packit |
7cfc04 |
<apostrophe>.)
|
|
Packit |
7cfc04 |
The integer portion of the result of a decimal conversion (\c
|
|
Packit |
7cfc04 |
.BR %i ,
|
|
Packit |
7cfc04 |
.BR %d ,
|
|
Packit |
7cfc04 |
.BR %u ,
|
|
Packit |
7cfc04 |
.BR %f ,
|
|
Packit |
7cfc04 |
.BR %F ,
|
|
Packit |
7cfc04 |
.BR %g ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR %G )
|
|
Packit |
7cfc04 |
shall be formatted with thousands' grouping wide characters. For other
|
|
Packit |
7cfc04 |
conversions, the behavior is undefined. The numeric grouping wide
|
|
Packit |
7cfc04 |
character is used.
|
|
Packit |
7cfc04 |
.IP "\fR\(mi\fR" 8
|
|
Packit |
7cfc04 |
The result of the conversion shall be left-justified within the field.
|
|
Packit |
7cfc04 |
The conversion shall be right-justified if this flag is not specified.
|
|
Packit |
7cfc04 |
.IP "\fR+\fR" 8
|
|
Packit |
7cfc04 |
The result of a signed conversion shall always begin with a sign (\c
|
|
Packit |
7cfc04 |
.BR '+'
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR '\(mi' ).
|
|
Packit |
7cfc04 |
The conversion shall begin with a sign only when a negative value is
|
|
Packit |
7cfc04 |
converted if this flag is not specified.
|
|
Packit |
7cfc04 |
.IP <space> 8
|
|
Packit |
7cfc04 |
If the first wide character of a signed conversion is not a sign, or if
|
|
Packit |
7cfc04 |
a signed conversion results in no wide characters, a
|
|
Packit |
7cfc04 |
<space>
|
|
Packit |
7cfc04 |
shall be prefixed to the result. This means that if the
|
|
Packit |
7cfc04 |
<space>
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR '+'
|
|
Packit |
7cfc04 |
flags both appear, the
|
|
Packit |
7cfc04 |
<space>
|
|
Packit |
7cfc04 |
flag shall be ignored.
|
|
Packit |
7cfc04 |
.IP "\fR#\fR" 8
|
|
Packit |
7cfc04 |
Specifies that the value is to be converted to an alternative form.
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.BR o
|
|
Packit |
7cfc04 |
conversion, it increases the precision (if necessary) to force the
|
|
Packit |
7cfc04 |
first digit of the result to be 0. For
|
|
Packit |
7cfc04 |
.BR x
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifiers, a non-zero result shall have 0x (or 0X) prefixed
|
|
Packit |
7cfc04 |
to it. For
|
|
Packit |
7cfc04 |
.BR a ,
|
|
Packit |
7cfc04 |
.BR A ,
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
.BR F ,
|
|
Packit |
7cfc04 |
.BR g ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifiers, the result shall always contain a radix
|
|
Packit |
7cfc04 |
character, even if no digits follow it. Without this flag, a radix
|
|
Packit |
7cfc04 |
character appears in the result of these conversions only if a digit
|
|
Packit |
7cfc04 |
follows it. For
|
|
Packit |
7cfc04 |
.BR g
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifiers, trailing zeros shall
|
|
Packit |
7cfc04 |
.IR not
|
|
Packit |
7cfc04 |
be removed from the result as they normally are. For other conversion
|
|
Packit |
7cfc04 |
specifiers, the behavior is undefined.
|
|
Packit |
7cfc04 |
.IP "\fR0\fR" 8
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
.BR X ,
|
|
Packit |
7cfc04 |
.BR a ,
|
|
Packit |
7cfc04 |
.BR A ,
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
.BR F ,
|
|
Packit |
7cfc04 |
.BR g ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifiers, leading zeros (following any indication of sign
|
|
Packit |
7cfc04 |
or base) are used to pad to the field width rather than performing
|
|
Packit |
7cfc04 |
space padding, except when converting an infinity or NaN. If the
|
|
Packit |
7cfc04 |
.BR '0'
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR '\(mi'
|
|
Packit |
7cfc04 |
flags both appear, the
|
|
Packit |
7cfc04 |
.BR '0'
|
|
Packit |
7cfc04 |
flag shall be ignored. For
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifiers, if a precision is specified, the
|
|
Packit |
7cfc04 |
.BR '0'
|
|
Packit |
7cfc04 |
flag shall be ignored.
|
|
Packit |
7cfc04 |
If the
|
|
Packit |
7cfc04 |
.BR '0'
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
<apostrophe>
|
|
Packit |
7cfc04 |
flags both appear, the grouping wide characters are inserted before
|
|
Packit |
7cfc04 |
zero padding. For other conversions, the behavior is undefined.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The length modifiers and their meanings are:
|
|
Packit |
7cfc04 |
.IP "\fRhh\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR "signed char"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned char"
|
|
Packit |
7cfc04 |
argument (the argument will have been promoted according to the integer
|
|
Packit |
7cfc04 |
promotions, but its value shall be converted to
|
|
Packit |
7cfc04 |
.BR "signed char"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned char"
|
|
Packit |
7cfc04 |
before printing); or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR "signed char"
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRh\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR "short"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned short"
|
|
Packit |
7cfc04 |
argument (the argument will have been promoted according to the integer
|
|
Packit |
7cfc04 |
promotions, but its value shall be converted to
|
|
Packit |
7cfc04 |
.BR "short"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned short"
|
|
Packit |
7cfc04 |
before printing); or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR "short"
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRl\fR\ (ell)" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR "long"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned long"
|
|
Packit |
7cfc04 |
argument; that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR "long"
|
|
Packit |
7cfc04 |
argument; that a following
|
|
Packit |
7cfc04 |
.BR c
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR wint_t
|
|
Packit |
7cfc04 |
argument; that a following
|
|
Packit |
7cfc04 |
.BR s
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR wchar_t
|
|
Packit |
7cfc04 |
argument; or has no effect on a following
|
|
Packit |
7cfc04 |
.BR a ,
|
|
Packit |
7cfc04 |
.BR A ,
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
.BR F ,
|
|
Packit |
7cfc04 |
.BR g ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifier.
|
|
Packit |
7cfc04 |
.IP "\fRll\fR\ (ell-ell)" 8
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR "long long"
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "unsigned long long"
|
|
Packit |
7cfc04 |
argument; or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR "long long"
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRj\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to an
|
|
Packit |
7cfc04 |
.BR intmax_t
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR uintmax_t
|
|
Packit |
7cfc04 |
argument; or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to an
|
|
Packit |
7cfc04 |
.BR intmax_t
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRz\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR size_t
|
|
Packit |
7cfc04 |
or the corresponding signed integer type argument; or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a signed integer type
|
|
Packit |
7cfc04 |
corresponding to a
|
|
Packit |
7cfc04 |
.BR size_t
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRt\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR d ,
|
|
Packit |
7cfc04 |
.BR i ,
|
|
Packit |
7cfc04 |
.BR o ,
|
|
Packit |
7cfc04 |
.BR u ,
|
|
Packit |
7cfc04 |
.BR x ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR X
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR ptrdiff_t
|
|
Packit |
7cfc04 |
or the corresponding
|
|
Packit |
7cfc04 |
.BR unsigned
|
|
Packit |
7cfc04 |
type argument; or that a following
|
|
Packit |
7cfc04 |
.BR n
|
|
Packit |
7cfc04 |
conversion specifier applies to a pointer to a
|
|
Packit |
7cfc04 |
.BR ptrdiff_t
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.IP "\fRL\fR" 8
|
|
Packit |
7cfc04 |
Specifies that a following
|
|
Packit |
7cfc04 |
.BR a ,
|
|
Packit |
7cfc04 |
.BR A ,
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
.BR F ,
|
|
Packit |
7cfc04 |
.BR g ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifier applies to a
|
|
Packit |
7cfc04 |
.BR "long double"
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If a length modifier appears with any conversion specifier other than
|
|
Packit |
7cfc04 |
as specified above, the behavior is undefined.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The conversion specifiers and their meanings are:
|
|
Packit |
7cfc04 |
.IP "\fRd\fR,\ \fRi\fR" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR int
|
|
Packit |
7cfc04 |
argument shall be converted to a signed decimal in the style
|
|
Packit |
7cfc04 |
\fR"[\(mi]\fIdddd"\fR. The precision specifies the minimum number of
|
|
Packit |
7cfc04 |
digits to appear; if the value being converted can be represented in
|
|
Packit |
7cfc04 |
fewer digits, it shall be expanded with leading zeros. The default
|
|
Packit |
7cfc04 |
precision shall be 1. The result of converting zero with an explicit
|
|
Packit |
7cfc04 |
precision of zero shall be no wide characters.
|
|
Packit |
7cfc04 |
.IP "\fRo\fP" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR unsigned
|
|
Packit |
7cfc04 |
argument shall be converted to unsigned octal format in the style
|
|
Packit |
7cfc04 |
.BR \(dqdddd\(dq .
|
|
Packit |
7cfc04 |
The precision specifies the minimum number of digits to appear; if the
|
|
Packit |
7cfc04 |
value being converted can be represented in fewer digits, it shall be
|
|
Packit |
7cfc04 |
expanded with leading zeros. The default precision shall be 1. The
|
|
Packit |
7cfc04 |
result of converting zero with an explicit precision of zero shall be
|
|
Packit |
7cfc04 |
no wide characters.
|
|
Packit |
7cfc04 |
.IP "\fRu\fP" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR unsigned
|
|
Packit |
7cfc04 |
argument shall be converted to unsigned decimal format in the style
|
|
Packit |
7cfc04 |
.BR \(dqdddd\(dq .
|
|
Packit |
7cfc04 |
The precision specifies the minimum number of digits to appear; if the
|
|
Packit |
7cfc04 |
value being converted can be represented in fewer digits, it shall be
|
|
Packit |
7cfc04 |
expanded with leading zeros. The default precision shall be 1. The
|
|
Packit |
7cfc04 |
result of converting zero with an explicit precision of zero shall be
|
|
Packit |
7cfc04 |
no wide characters.
|
|
Packit |
7cfc04 |
.IP "\fRx\fP" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR unsigned
|
|
Packit |
7cfc04 |
argument shall be converted to unsigned hexadecimal format in the style
|
|
Packit |
7cfc04 |
.BR \(dqdddd\(dq ;
|
|
Packit |
7cfc04 |
the letters
|
|
Packit |
7cfc04 |
.BR \(dqabcdef\(dq
|
|
Packit |
7cfc04 |
are used. The precision specifies the minimum number of digits to
|
|
Packit |
7cfc04 |
appear; if the value being converted can be represented in fewer
|
|
Packit |
7cfc04 |
digits, it shall be expanded with leading zeros. The default precision
|
|
Packit |
7cfc04 |
shall be 1. The result of converting zero with an explicit precision of
|
|
Packit |
7cfc04 |
zero shall be no wide characters.
|
|
Packit |
7cfc04 |
.IP "\fRX\fP" 8
|
|
Packit |
7cfc04 |
Equivalent to the
|
|
Packit |
7cfc04 |
.BR x
|
|
Packit |
7cfc04 |
conversion specifier, except that letters
|
|
Packit |
7cfc04 |
.BR \(dqABCDEF\(dq
|
|
Packit |
7cfc04 |
are used instead of
|
|
Packit |
7cfc04 |
.BR \(dqabcdef\(dq .
|
|
Packit |
7cfc04 |
.IP "\fRf\fR,\ \fRF\fR" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument shall be converted to decimal notation in the style
|
|
Packit |
7cfc04 |
\fR"[\(mi]\fIddd.ddd"\fR, where the number of digits after the radix
|
|
Packit |
7cfc04 |
character shall be equal to the precision specification. If the
|
|
Packit |
7cfc04 |
precision is missing, it shall be taken as 6; if the precision is
|
|
Packit |
7cfc04 |
explicitly zero and no
|
|
Packit |
7cfc04 |
.BR '#'
|
|
Packit |
7cfc04 |
flag is present, no radix character shall appear. If a radix character
|
|
Packit |
7cfc04 |
appears, at least one digit shall appear before it. The value shall be
|
|
Packit |
7cfc04 |
rounded in an implementation-defined manner to the appropriate number
|
|
Packit |
7cfc04 |
of digits.
|
|
Packit |
7cfc04 |
.RS 8
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing an infinity shall be converted in one of the
|
|
Packit |
7cfc04 |
styles
|
|
Packit |
7cfc04 |
.BR \(dq[\(mi]inf\(dq
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR \(dq[\(mi]infinity\(dq ;
|
|
Packit |
7cfc04 |
which style is implementation-defined. A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing a NaN shall be converted in one of the styles
|
|
Packit |
7cfc04 |
.BR \(dq[\(mi]nan\(dq
|
|
Packit |
7cfc04 |
or \fR"[\(mi]nan(\fIn-char-sequence\fR)"\fR; which style, and the
|
|
Packit |
7cfc04 |
meaning of any \fIn-char-sequence\fR, is implementation-defined. The
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
conversion specifier produces
|
|
Packit |
7cfc04 |
.BR \(dqINF\(dq ,
|
|
Packit |
7cfc04 |
.BR \(dqINFINITY\(dq ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR \(dqNAN\(dq
|
|
Packit |
7cfc04 |
instead of
|
|
Packit |
7cfc04 |
.BR \(dqinf\(dq ,
|
|
Packit |
7cfc04 |
.BR \(dqinfinity\(dq ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR \(dqnan\(dq ,
|
|
Packit |
7cfc04 |
respectively.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fRe\fR,\ \fRE\fR" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument shall be converted in the style
|
|
Packit |
7cfc04 |
\fR"[\(mi]\fId.ddd\fRe\fR\(+-dd"\fR, where there shall be one digit
|
|
Packit |
7cfc04 |
before the radix character (which is non-zero if the argument is
|
|
Packit |
7cfc04 |
non-zero) and the number of digits after it shall be equal to the
|
|
Packit |
7cfc04 |
precision; if the precision is missing, it shall be taken as 6; if the
|
|
Packit |
7cfc04 |
precision is zero and no
|
|
Packit |
7cfc04 |
.BR '#'
|
|
Packit |
7cfc04 |
flag is present, no radix character shall appear. The value shall be
|
|
Packit |
7cfc04 |
rounded in an implementation-defined manner to the appropriate number
|
|
Packit |
7cfc04 |
of digits. The
|
|
Packit |
7cfc04 |
.BR E
|
|
Packit |
7cfc04 |
conversion wide character shall produce a number with
|
|
Packit |
7cfc04 |
.BR 'E'
|
|
Packit |
7cfc04 |
instead of
|
|
Packit |
7cfc04 |
.BR 'e'
|
|
Packit |
7cfc04 |
introducing the exponent. The exponent shall always contain at least
|
|
Packit |
7cfc04 |
two digits. If the value is zero, the exponent shall be zero.
|
|
Packit |
7cfc04 |
.RS 8
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing an infinity or NaN shall be converted in the
|
|
Packit |
7cfc04 |
style of an
|
|
Packit |
7cfc04 |
.BR f
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
conversion specifier.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fRg\fR,\ \fRG\fR" 8
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing a floating-point number shall be converted in the
|
|
Packit |
7cfc04 |
style
|
|
Packit |
7cfc04 |
.BR f
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR e
|
|
Packit |
7cfc04 |
(or in the style
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR E
|
|
Packit |
7cfc04 |
in the case of a
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifier), depending on the value converted and the precision.
|
|
Packit |
7cfc04 |
Let
|
|
Packit |
7cfc04 |
.BR P
|
|
Packit |
7cfc04 |
equal the precision if non-zero, 6 if the precision is omitted, or 1 if the
|
|
Packit |
7cfc04 |
precision is zero. Then, if a conversion with style
|
|
Packit |
7cfc04 |
.BR E
|
|
Packit |
7cfc04 |
would have an exponent of
|
|
Packit |
7cfc04 |
.IR X :
|
|
Packit |
7cfc04 |
.RS 8
|
|
Packit |
7cfc04 |
.IP -- 4
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.BR P >\c
|
|
Packit |
7cfc04 |
.IR X \(>=\(mi4,
|
|
Packit |
7cfc04 |
the conversion shall be with style
|
|
Packit |
7cfc04 |
.BR f
|
|
Packit |
7cfc04 |
(or
|
|
Packit |
7cfc04 |
.BR F )
|
|
Packit |
7cfc04 |
and precision
|
|
Packit |
7cfc04 |
.BR P \(mi(\c
|
|
Packit |
7cfc04 |
.IR X +1).
|
|
Packit |
7cfc04 |
.IP -- 4
|
|
Packit |
7cfc04 |
Otherwise, the conversion shall be with style
|
|
Packit |
7cfc04 |
.BR e
|
|
Packit |
7cfc04 |
(or
|
|
Packit |
7cfc04 |
.BR E )
|
|
Packit |
7cfc04 |
and precision
|
|
Packit |
7cfc04 |
.BR P \(mi1.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Finally, unless the
|
|
Packit |
7cfc04 |
.BR '#'
|
|
Packit |
7cfc04 |
flag is used, any trailing zeros shall be removed from the fractional
|
|
Packit |
7cfc04 |
portion of the result and the decimal-point character shall be removed
|
|
Packit |
7cfc04 |
if there is no fractional portion remaining.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing an infinity or NaN shall be converted in the
|
|
Packit |
7cfc04 |
style of an
|
|
Packit |
7cfc04 |
.BR f
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
conversion specifier.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fRa\fR,\ \fRA\fR" 8
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing a floating-point number shall be converted in
|
|
Packit |
7cfc04 |
the style \fR"[\(mi]0x\fIh\fR.\fIhhhh\fRp\(+-\fId\fR"\fR, where there
|
|
Packit |
7cfc04 |
shall be one hexadecimal digit (which is non-zero if the argument is a
|
|
Packit |
7cfc04 |
normalized floating-point number and is otherwise unspecified) before
|
|
Packit |
7cfc04 |
the decimal-point wide character and the number of hexadecimal digits
|
|
Packit |
7cfc04 |
after it shall be equal to the precision; if the precision is missing
|
|
Packit |
7cfc04 |
and FLT_RADIX is a power of 2, then the precision shall be sufficient
|
|
Packit |
7cfc04 |
for an exact representation of the value; if the precision is missing
|
|
Packit |
7cfc04 |
and FLT_RADIX is not a power of 2, then the precision shall be sufficient
|
|
Packit |
7cfc04 |
to distinguish values of type
|
|
Packit |
7cfc04 |
.BR double ,
|
|
Packit |
7cfc04 |
except that trailing zeros may be omitted; if the precision is zero and
|
|
Packit |
7cfc04 |
the
|
|
Packit |
7cfc04 |
.BR '#'
|
|
Packit |
7cfc04 |
flag is not specified, no decimal-point wide character shall appear.
|
|
Packit |
7cfc04 |
The letters
|
|
Packit |
7cfc04 |
.BR \(dqabcdef\(dq
|
|
Packit |
7cfc04 |
are used for
|
|
Packit |
7cfc04 |
.BR a
|
|
Packit |
7cfc04 |
conversion and the letters
|
|
Packit |
7cfc04 |
.BR \(dqABCDEF\(dq
|
|
Packit |
7cfc04 |
for
|
|
Packit |
7cfc04 |
.BR A
|
|
Packit |
7cfc04 |
conversion. The
|
|
Packit |
7cfc04 |
.BR A
|
|
Packit |
7cfc04 |
conversion specifier produces a number with
|
|
Packit |
7cfc04 |
.BR 'X'
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR 'P'
|
|
Packit |
7cfc04 |
instead of
|
|
Packit |
7cfc04 |
.BR 'x'
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR 'p' .
|
|
Packit |
7cfc04 |
The exponent shall always contain at least one digit, and only as many
|
|
Packit |
7cfc04 |
more digits as necessary to represent the decimal exponent of 2. If the
|
|
Packit |
7cfc04 |
value is zero, the exponent shall be zero.
|
|
Packit |
7cfc04 |
.RS 8
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.BR double
|
|
Packit |
7cfc04 |
argument representing an infinity or NaN shall be converted in the
|
|
Packit |
7cfc04 |
style of an
|
|
Packit |
7cfc04 |
.BR f
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR F
|
|
Packit |
7cfc04 |
conversion specifier.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fRc\fP" 8
|
|
Packit |
7cfc04 |
If no
|
|
Packit |
7cfc04 |
.BR l
|
|
Packit |
7cfc04 |
(ell) qualifier is present, the
|
|
Packit |
7cfc04 |
.BR int
|
|
Packit |
7cfc04 |
argument shall be converted to a wide character as if by calling the
|
|
Packit |
7cfc04 |
\fIbtowc\fR()
|
|
Packit |
7cfc04 |
function and the resulting wide character shall be written. Otherwise,
|
|
Packit |
7cfc04 |
the
|
|
Packit |
7cfc04 |
.BR wint_t
|
|
Packit |
7cfc04 |
argument shall be converted to
|
|
Packit |
7cfc04 |
.BR wchar_t ,
|
|
Packit |
7cfc04 |
and written.
|
|
Packit |
7cfc04 |
.IP "\fRs\fP" 8
|
|
Packit |
7cfc04 |
If no
|
|
Packit |
7cfc04 |
.BR l
|
|
Packit |
7cfc04 |
(ell) qualifier is present, the application shall ensure that the
|
|
Packit |
7cfc04 |
argument is a pointer to a character array containing a character
|
|
Packit |
7cfc04 |
sequence beginning in the initial shift state. Characters from the
|
|
Packit |
7cfc04 |
array shall be converted as if by repeated calls to the
|
|
Packit |
7cfc04 |
\fImbrtowc\fR()
|
|
Packit |
7cfc04 |
function, with the conversion state described by an
|
|
Packit |
7cfc04 |
.BR mbstate_t
|
|
Packit |
7cfc04 |
object initialized to zero before the first character is converted, and
|
|
Packit |
7cfc04 |
written up to (but not including) the terminating null wide character.
|
|
Packit |
7cfc04 |
If the precision is specified, no more than that many wide characters
|
|
Packit |
7cfc04 |
shall be written. If the precision is not specified, or is greater than
|
|
Packit |
7cfc04 |
the size of the array, the application shall ensure that the array
|
|
Packit |
7cfc04 |
contains a null wide character.
|
|
Packit |
7cfc04 |
.RS 8
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If an
|
|
Packit |
7cfc04 |
.BR l
|
|
Packit |
7cfc04 |
(ell) qualifier is present, the application shall ensure that the
|
|
Packit |
7cfc04 |
argument is a pointer to an array of type
|
|
Packit |
7cfc04 |
.BR wchar_t .
|
|
Packit |
7cfc04 |
Wide characters from the array shall be written up to (but not
|
|
Packit |
7cfc04 |
including) a terminating null wide character. If no precision is
|
|
Packit |
7cfc04 |
specified, or is greater than the size of the array, the application
|
|
Packit |
7cfc04 |
shall ensure that the array contains a null wide character. If a
|
|
Packit |
7cfc04 |
precision is specified, no more than that many wide characters shall be
|
|
Packit |
7cfc04 |
written.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fRp\fP" 8
|
|
Packit |
7cfc04 |
The application shall ensure that the argument is a pointer to
|
|
Packit |
7cfc04 |
.BR void .
|
|
Packit |
7cfc04 |
The value of the pointer shall be converted to a sequence of printable
|
|
Packit |
7cfc04 |
wide characters in an implementation-defined manner.
|
|
Packit |
7cfc04 |
.IP "\fRn\fP" 8
|
|
Packit |
7cfc04 |
The application shall ensure that the argument is a pointer to an
|
|
Packit |
7cfc04 |
integer into which is written the number of wide characters written to
|
|
Packit |
7cfc04 |
the output so far by this call to one of the
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
functions. No argument shall be converted, but one shall be consumed.
|
|
Packit |
7cfc04 |
If the conversion specification includes any flags, a field width, or a
|
|
Packit |
7cfc04 |
precision, the behavior is undefined.
|
|
Packit |
7cfc04 |
.IP "\fRC\fP" 8
|
|
Packit |
7cfc04 |
Equivalent to
|
|
Packit |
7cfc04 |
.BR lc .
|
|
Packit |
7cfc04 |
.IP "\fRS\fP" 8
|
|
Packit |
7cfc04 |
Equivalent to
|
|
Packit |
7cfc04 |
.BR ls .
|
|
Packit |
7cfc04 |
.IP "\fR%\fR" 8
|
|
Packit |
7cfc04 |
Output a
|
|
Packit |
7cfc04 |
.BR '%'
|
|
Packit |
7cfc04 |
wide character; no argument shall be converted. The entire conversion
|
|
Packit |
7cfc04 |
specification shall be
|
|
Packit |
7cfc04 |
.BR %% .
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If a conversion specification does not match one of the above forms,
|
|
Packit |
7cfc04 |
the behavior is undefined.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In no case does a nonexistent or small field width cause truncation of
|
|
Packit |
7cfc04 |
a field; if the result of a conversion is wider than the field width,
|
|
Packit |
7cfc04 |
the field shall be expanded to contain the conversion result.
|
|
Packit |
7cfc04 |
Characters generated by
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIwprintf\fR()
|
|
Packit |
7cfc04 |
shall be printed as if
|
|
Packit |
7cfc04 |
\fIfputwc\fR()
|
|
Packit |
7cfc04 |
had been called.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.BR a
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR A
|
|
Packit |
7cfc04 |
conversions, if FLT_RADIX is not a power of 2 and the result is not
|
|
Packit |
7cfc04 |
exactly representable in the given precision, the result should be one
|
|
Packit |
7cfc04 |
of the two adjacent numbers in hexadecimal floating style with the
|
|
Packit |
7cfc04 |
given precision, with the extra stipulation that the error should have
|
|
Packit |
7cfc04 |
a correct sign for the current rounding direction.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.BR e ,
|
|
Packit |
7cfc04 |
.BR E ,
|
|
Packit |
7cfc04 |
.BR f ,
|
|
Packit |
7cfc04 |
.BR F ,
|
|
Packit |
7cfc04 |
.BR g ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR G
|
|
Packit |
7cfc04 |
conversion specifiers, if the number of significant decimal digits is
|
|
Packit |
7cfc04 |
at most DECIMAL_DIG, then the result should be correctly rounded. If
|
|
Packit |
7cfc04 |
the number of significant decimal digits is more than DECIMAL_DIG but
|
|
Packit |
7cfc04 |
the source value is exactly representable with DECIMAL_DIG digits, then
|
|
Packit |
7cfc04 |
the result should be an exact representation with trailing zeros.
|
|
Packit |
7cfc04 |
Otherwise, the source value is bounded by two adjacent decimal strings
|
|
Packit |
7cfc04 |
.IR L
|
|
Packit |
7cfc04 |
<
|
|
Packit |
7cfc04 |
.IR U ,
|
|
Packit |
7cfc04 |
both having DECIMAL_DIG significant digits; the value of the resultant
|
|
Packit |
7cfc04 |
decimal string
|
|
Packit |
7cfc04 |
.IR D
|
|
Packit |
7cfc04 |
should satisfy
|
|
Packit |
7cfc04 |
.IR L
|
|
Packit |
7cfc04 |
<=
|
|
Packit |
7cfc04 |
.IR D
|
|
Packit |
7cfc04 |
<=
|
|
Packit |
7cfc04 |
.IR U ,
|
|
Packit |
7cfc04 |
with the extra stipulation that the error should have a correct sign
|
|
Packit |
7cfc04 |
for the current rounding direction.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The last data modification and last file status change timestamps
|
|
Packit |
7cfc04 |
of the file shall be marked for update between the call to a
|
|
Packit |
7cfc04 |
successful execution of
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIwprintf\fR()
|
|
Packit |
7cfc04 |
and the next successful completion of a call to
|
|
Packit |
7cfc04 |
\fIfflush\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIfclose\fR()
|
|
Packit |
7cfc04 |
on the same stream, or a call to
|
|
Packit |
7cfc04 |
\fIexit\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIabort\fR().
|
|
Packit |
7cfc04 |
.SH "RETURN VALUE"
|
|
Packit |
7cfc04 |
Upon successful completion, these functions shall return the number of
|
|
Packit |
7cfc04 |
wide characters transmitted, excluding the terminating null wide character
|
|
Packit |
7cfc04 |
in the case of
|
|
Packit |
7cfc04 |
\fIswprintf\fR(),
|
|
Packit |
7cfc04 |
or a negative value if an output error was encountered,
|
|
Packit |
7cfc04 |
and set
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
to indicate the error.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
or more wide characters were requested to be written,
|
|
Packit |
7cfc04 |
\fIswprintf\fR()
|
|
Packit |
7cfc04 |
shall return a negative value,
|
|
Packit |
7cfc04 |
and set
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
to indicate the error.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
For the conditions under which
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIwprintf\fR()
|
|
Packit |
7cfc04 |
fail and may fail, refer to
|
|
Packit |
7cfc04 |
.IR "\fIfputwc\fR\^(\|)".
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In addition, all forms of
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
shall fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR EILSEQ
|
|
Packit |
7cfc04 |
A wide-character code that does not correspond to a valid character has
|
|
Packit |
7cfc04 |
been detected.
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In addition, all forms of
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
may fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR EINVAL
|
|
Packit |
7cfc04 |
There are insufficient arguments.
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In addition,
|
|
Packit |
7cfc04 |
\fIfwprintf\fR()
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIwprintf\fR()
|
|
Packit |
7cfc04 |
may fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR ENOMEM
|
|
Packit |
7cfc04 |
Insufficient storage space is available.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIswprintf\fR()
|
|
Packit |
7cfc04 |
shall fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR EOVERFLOW
|
|
Packit |
7cfc04 |
The value of
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
is greater than
|
|
Packit |
7cfc04 |
{INT_MAX}
|
|
Packit |
7cfc04 |
or the number of bytes needed to hold the output excluding the
|
|
Packit |
7cfc04 |
terminating null is greater than
|
|
Packit |
7cfc04 |
{INT_MAX}.
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.IR "The following sections are informative."
|
|
Packit |
7cfc04 |
.SH "EXAMPLES"
|
|
Packit |
7cfc04 |
To print the language-independent date and time format, the following
|
|
Packit |
7cfc04 |
statement could be used:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
wprintf(format, weekday, month, day, hour, min);
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For American usage,
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
could be a pointer to the wide-character string:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
L"%s, %s %d, %d:%.2d\en"
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
producing the message:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
Sunday, July 3, 10:02
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
whereas for German usage,
|
|
Packit |
7cfc04 |
.IR format
|
|
Packit |
7cfc04 |
could be a pointer to the wide-character string:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
L"%1$s, %3$d. %2$s, %4$d:%5$.2d\en"
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
producing the message:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
Sonntag, 3. Juli, 10:02
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.SH "APPLICATION USAGE"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH RATIONALE
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "FUTURE DIRECTIONS"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "SEE ALSO"
|
|
Packit |
7cfc04 |
.IR "Section 2.5" ", " "Standard I/O Streams",
|
|
Packit |
7cfc04 |
.IR "\fIbtowc\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIfputwc\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIfwscanf\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fImbrtowc\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIsetlocale\fR\^(\|)"
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Chapter 7" ", " "Locale",
|
|
Packit |
7cfc04 |
.IR "\fB<stdio.h>\fP",
|
|
Packit |
7cfc04 |
.IR "\fB<wchar.h>\fP"
|
|
Packit |
7cfc04 |
.SH COPYRIGHT
|
|
Packit |
7cfc04 |
Portions of this text are reprinted and reproduced in electronic form
|
|
Packit |
7cfc04 |
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
|
|
Packit |
7cfc04 |
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Packit |
7cfc04 |
Specifications Issue 7, Copyright (C) 2013 by the Institute of
|
|
Packit |
7cfc04 |
Electrical and Electronics Engineers, Inc and The Open Group.
|
|
Packit |
7cfc04 |
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
|
|
Packit |
7cfc04 |
event of any discrepancy between this version and the original IEEE and
|
|
Packit |
7cfc04 |
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
Packit |
7cfc04 |
is the referee document. The original Standard can be obtained online at
|
|
Packit |
7cfc04 |
http://www.unix.org/online.html .
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
Any typographical or formatting errors that appear
|
|
Packit |
7cfc04 |
in this page are most likely
|
|
Packit |
7cfc04 |
to have been introduced during the conversion of the source files to
|
|
Packit |
7cfc04 |
man page format. To report such errors, see
|
|
Packit |
7cfc04 |
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|