1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
10 .\" References consulted:
11 .\" GNU glibc-2 source code and manual
12 .\" Dinkumware C library reference http://www.dinkumware.com/
13 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
16 .TH WPRINTF 3 2017-09-15 "GNU" "Linux Programmer's Manual"
18 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- formatted
19 wide-character output conversion
25 .BI "int wprintf(const wchar_t *" format ", ...);"
26 .BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
27 .BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
28 .BI " const wchar_t *" format ", ...);"
30 .BI "int vwprintf(const wchar_t *" format ", va_list " args );
31 .BI "int vfwprintf(FILE *" stream ", const wchar_t *" format ", va_list " args );
32 .BI "int vswprintf(wchar_t *" wcs ", size_t " maxlen ,
33 .BI " const wchar_t *" format ", va_list " args );
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
42 All functions shown above:
50 _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE ||
52 _POSIX_C_SOURCE\ >=\ 200112L
58 family of functions is
59 the wide-character equivalent of the
62 It performs formatted output of wide
70 perform wide-character output to
73 must not be byte oriented; see
82 perform wide-character output to
85 must not be byte oriented; see
94 perform wide-character output
95 to an array of wide characters.
96 The programmer must ensure that there is
103 These functions are like
111 functions except for the
112 following differences:
117 string is a wide-character string.
120 The output consists of wide characters, not bytes.
138 argument, but these functions do not return \-1 upon
139 buffer overflow on Linux.)
141 The treatment of the conversion characters
150 modifier is present, the
152 argument is converted to a wide character by a call to the
154 function, and the resulting wide character is written.
157 modifier is present, the
159 (wide character) argument is written.
164 modifier is present: the
166 argument is expected to be a pointer to an array of character type
167 (pointer to a string) containing a multibyte character sequence beginning
168 in the initial shift state.
169 Characters from the array are converted to
170 wide characters (each by a call to the
172 function with a conversion state starting in the initial state before
174 The resulting wide characters are written up to
175 (but not including) the terminating null wide character (L\(aq\\0\(aq).
177 specified, no more wide characters than the number specified are written.
178 Note that the precision determines the number of
180 written, not the number of
183 .IR "screen positions" .
184 The array must contain a terminating null byte (\(aq\\0\(aq),
185 unless a precision is given
186 and it is so small that the number of converted wide characters reaches it
187 before the end of the array is reached.
190 modifier is present: the
191 .I "const\ wchar_t\ *"
192 argument is expected to be a pointer to an array of wide characters.
193 Wide characters from the array are written up to (but not including) a
194 terminating null wide character.
195 If a precision is specified, no more than
196 the number specified are written.
197 The array must contain a terminating null
198 wide character, unless a precision is given and it is smaller than or equal
199 to the number of wide characters in the array.
201 The functions return the number of wide characters written, excluding the
202 terminating null wide character in
203 case of the functions
207 They return \-1 when an error occurs.
209 For an explanation of the terms used in this section, see
215 Interface Attribute Value
225 T} Thread safety MT-Safe locale
229 POSIX.1-2001, POSIX.1-2008, C99.
241 string contains non-ASCII wide characters, the program
242 will work correctly only if the
244 category of the current locale at
245 run time is the same as the
247 category of the current locale at
251 representation is platform- and locale-dependent.
252 (The glibc represents
253 wide characters using their Unicode (ISO-10646) code point, but other
254 platforms don't do this.
255 Also, the use of C99 universal character names
256 of the form \\unnnn does not solve this problem.)
258 internationalized programs, the
260 string should consist of ASCII
261 wide characters only, or should be constructed at run time in an
262 internationalized way (e.g., using