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 2011-09-17 "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 _ISOC95_SOURCE /* Since glibc 2.12 */ ||
54 _POSIX_C_SOURCE\ >=\ 200112L;
63 family of functions is
64 the wide-character equivalent of the
67 It performs formatted output of wide
75 perform wide-character output to
78 must not be byte oriented; see
87 perform wide-character output to
90 must not be byte oriented; see
99 perform wide-character output
100 to an array of wide characters.
101 The programmer must ensure that there is
108 These functions are like
116 functions except for the
117 following differences:
122 string is a wide-character string.
125 The output consists of wide characters, not bytes.
143 argument, but these functions do not return \-1 upon
144 buffer overflow on Linux.)
146 The treatment of the conversion characters
155 modifier is present, the
157 argument is converted to a wide character by a call to the
159 function, and the resulting wide character is written.
162 modifier is present, the
164 (wide character) argument is written.
169 modifier is present: The
171 argument is expected to be a pointer to an array of character type
172 (pointer to a string) containing a multibyte character sequence beginning
173 in the initial shift state.
174 Characters from the array are converted to
175 wide characters (each by a call to the
177 function with a conversion state starting in the initial state before
179 The resulting wide characters are written up to
180 (but not including) the terminating null wide character (L\(aq\\0\(aq).
182 specified, no more wide characters than the number specified are written.
183 Note that the precision determines the number of
185 written, not the number of
188 .IR "screen positions" .
189 The array must contain a terminating null byte (\(aq\\0\(aq),
190 unless a precision is given
191 and it is so small that the number of converted wide characters reaches it
192 before the end of the array is reached.
195 modifier is present: The
196 .I "const\ wchar_t\ *"
197 argument is expected to be a pointer to an array of wide characters.
198 Wide characters from the array are written up to (but not including) a
199 terminating null wide character.
200 If a precision is specified, no more than
201 the number specified are written.
202 The array must contain a terminating null
203 wide character, unless a precision is given and it is smaller than or equal
204 to the number of wide characters in the array.
206 The functions return the number of wide characters written, excluding the
207 terminating null wide character in
208 case of the functions
212 They return \-1 when an error occurs.
226 string contains non-ASCII wide characters, the program
227 will work correctly only if the
229 category of the current locale at
230 run time is the same as the
232 category of the current locale at
236 representation is platform- and locale-dependent.
237 (The glibc represents
238 wide characters using their Unicode (ISO-10646) code point, but other
239 platforms don't do this.
240 Also, the use of C99 universal character names
241 of the form \\unnnn does not solve this problem.)
243 internationalized programs, the
245 string should consist of ASCII
246 wide characters only, or should be constructed at run time in an
247 internationalized way (e.g., using