2 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\" References consulted:
7 .\" GNU glibc-2 source code and manual
8 .\" Dinkumware C library reference http://www.dinkumware.com/
9 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
12 .TH wprintf 3 (date) "Linux man-pages (unreleased)"
14 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- formatted
15 wide-character output conversion
18 .RI ( libc ", " \-lc )
24 .BI "int wprintf(const wchar_t *restrict " format ", ...);"
25 .BI "int fwprintf(FILE *restrict " stream ,
26 .BI " const wchar_t *restrict " format ", ...);"
27 .BI "int swprintf(wchar_t " wcs "[restrict ." maxlen "], size_t " maxlen ,
28 .BI " const wchar_t *restrict " format ", ...);"
30 .BI "int vwprintf(const wchar_t *restrict " format ", va_list " args );
31 .BI "int vfwprintf(FILE *restrict " stream ,
32 .BI " const wchar_t *restrict " format ", va_list " args );
33 .BI "int vswprintf(wchar_t " wcs "[restrict ." maxlen "], size_t " maxlen ,
34 .BI " const wchar_t *restrict " format ", va_list " args );
38 Feature Test Macro Requirements for glibc (see
39 .BR feature_test_macros (7)):
42 All functions shown above:
50 _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE
51 || _POSIX_C_SOURCE >= 200112L
56 family of functions is
57 the wide-character equivalent of the
60 It performs formatted output of wide
68 perform wide-character output to
71 must not be byte oriented; see
80 perform wide-character output to
83 must not be byte oriented; see
92 perform wide-character output
93 to an array of wide characters.
94 The programmer must ensure that there is
101 These functions are like
109 functions except for the
110 following differences:
115 string is a wide-character string.
118 The output consists of wide characters, not bytes.
136 argument, but these functions do not return \-1 upon
137 buffer overflow on Linux.)
139 The treatment of the conversion characters
148 modifier is present, the
150 argument is converted to a wide character by a call to the
152 function, and the resulting wide character is written.
155 modifier is present, the
157 (wide character) argument is written.
162 modifier is present: the
164 argument is expected to be a pointer to an array of character type
165 (pointer to a string) containing a multibyte character sequence beginning
166 in the initial shift state.
167 Characters from the array are converted to
168 wide characters (each by a call to the
170 function with a conversion state starting in the initial state before
172 The resulting wide characters are written up to
173 (but not including) the terminating null wide character (L\[aq]\e0\[aq]).
175 specified, no more wide characters than the number specified are written.
176 Note that the precision determines the number of
178 written, not the number of
181 .IR "screen positions" .
182 The array must contain a terminating null byte (\[aq]\e0\[aq]),
183 unless a precision is given
184 and it is so small that the number of converted wide characters reaches it
185 before the end of the array is reached.
188 modifier is present: the
189 .I "const\ wchar_t\ *"
190 argument is expected to be a pointer to an array of wide characters.
191 Wide characters from the array are written up to (but not including) a
192 terminating null wide character.
193 If a precision is specified, no more than
194 the number specified are written.
195 The array must contain a terminating null
196 wide character, unless a precision is given and it is smaller than or equal
197 to the number of wide characters in the array.
199 The functions return the number of wide characters written, excluding the
200 terminating null wide character in
201 case of the functions
205 They return \-1 when an error occurs.
207 For an explanation of the terms used in this section, see
213 Interface Attribute Value
223 T} Thread safety MT-Safe locale
240 string contains non-ASCII wide characters, the program
241 will work correctly only if the
243 category of the current locale at
244 run time is the same as the
246 category of the current locale at
250 representation is platform- and locale-dependent.
251 (The glibc represents
252 wide characters using their Unicode (ISO/IEC 10646) code point, but other
253 platforms don't do this.
254 Also, the use of C99 universal character names
255 of the form \eunnnn does not solve this problem.)
257 internationalized programs, the
259 string should consist of ASCII
260 wide characters only, or should be constructed at run time in an
261 internationalized way (e.g., using