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 2014-03-19 "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;
61 family of functions is
62 the wide-character equivalent of the
65 It performs formatted output of wide
73 perform wide-character output to
76 must not be byte oriented; see
85 perform wide-character output to
88 must not be byte oriented; see
97 perform wide-character output
98 to an array of wide characters.
99 The programmer must ensure that there is
106 These functions are like
114 functions except for the
115 following differences:
120 string is a wide-character string.
123 The output consists of wide characters, not bytes.
141 argument, but these functions do not return \-1 upon
142 buffer overflow on Linux.)
144 The treatment of the conversion characters
153 modifier is present, the
155 argument is converted to a wide character by a call to the
157 function, and the resulting wide character is written.
160 modifier is present, the
162 (wide character) argument is written.
167 modifier is present: The
169 argument is expected to be a pointer to an array of character type
170 (pointer to a string) containing a multibyte character sequence beginning
171 in the initial shift state.
172 Characters from the array are converted to
173 wide characters (each by a call to the
175 function with a conversion state starting in the initial state before
177 The resulting wide characters are written up to
178 (but not including) the terminating null wide character (L\(aq\\0\(aq).
180 specified, no more wide characters than the number specified are written.
181 Note that the precision determines the number of
183 written, not the number of
186 .IR "screen positions" .
187 The array must contain a terminating null byte (\(aq\\0\(aq),
188 unless a precision is given
189 and it is so small that the number of converted wide characters reaches it
190 before the end of the array is reached.
193 modifier is present: The
194 .I "const\ wchar_t\ *"
195 argument is expected to be a pointer to an array of wide characters.
196 Wide characters from the array are written up to (but not including) a
197 terminating null wide character.
198 If a precision is specified, no more than
199 the number specified are written.
200 The array must contain a terminating null
201 wide character, unless a precision is given and it is smaller than or equal
202 to the number of wide characters in the array.
204 The functions return the number of wide characters written, excluding the
205 terminating null wide character in
206 case of the functions
210 They return \-1 when an error occurs.
224 string contains non-ASCII wide characters, the program
225 will work correctly only if the
227 category of the current locale at
228 run time is the same as the
230 category of the current locale at
234 representation is platform- and locale-dependent.
235 (The glibc represents
236 wide characters using their Unicode (ISO-10646) code point, but other
237 platforms don't do this.
238 Also, the use of C99 universal character names
239 of the form \\unnnn does not solve this problem.)
241 internationalized programs, the
243 string should consist of ASCII
244 wide characters only, or should be constructed at run time in an
245 internationalized way (e.g., using