1wchar.h(0P) POSIX Programmer's Manual wchar.h(0P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 wchar.h — wide-character handling
14
16 #include <wchar.h>
17
19 Some of the functionality described on this reference page extends the
20 ISO C standard. Applications shall define the appropriate feature test
21 macro (see the System Interfaces volume of POSIX.1‐2008, Section 2.2,
22 The Compilation Environment) to enable the visibility of these symbols
23 in this header.
24
25 The <wchar.h> header shall define the following types:
26
27 FILE As described in <stdio.h>.
28
29 locale_t As described in <locale.h>.
30
31 mbstate_t An object type other than an array type that can hold the
32 conversion state information necessary to convert between
33 sequences of (possibly multi-byte) characters and wide
34 characters. If a codeset is being used such that an
35 mbstate_t needs to preserve more than two levels of
36 reserved state, the results are unspecified.
37
38 size_t As described in <stddef.h>.
39
40 va_list As described in <stdarg.h>.
41
42 wchar_t As described in <stddef.h>.
43
44 wctype_t A scalar type of a data object that can hold values which
45 represent locale-specific character classification.
46
47 wint_t An integer type capable of storing any valid value of
48 wchar_t or WEOF.
49
50 The tag tm shall be declared as naming an incomplete structure type,
51 the contents of which are described in the <time.h> header.
52
53 The implementation shall support one or more programming environments
54 in which the width of wint_t is no greater than the width of type long.
55 The names of these programming environments can be obtained using the
56 confstr() function or the getconf utility.
57
58 The <wchar.h> header shall define the following macros:
59
60 WCHAR_MAX As described in <stdint.h>.
61
62 WCHAR_MIN As described in <stdint.h>.
63
64 WEOF Constant expression of type wint_t that is returned by sev‐
65 eral WP functions to indicate end-of-file.
66
67 NULL As described in <stddef.h>.
68
69 Inclusion of the <wchar.h> header may make visible all symbols from the
70 headers <ctype.h>, <string.h>, <stdarg.h>, <stddef.h>, <stdio.h>,
71 <stdlib.h>, and <time.h>.
72
73 The following shall be declared as functions and may also be defined as
74 macros. Function prototypes shall be provided for use with ISO C stan‐
75 dard compilers.
76
77 wint_t btowc(int);
78 wint_t fgetwc(FILE *);
79 wchar_t *fgetws(wchar_t *restrict, int, FILE *restrict);
80 wint_t fputwc(wchar_t, FILE *);
81 int fputws(const wchar_t *restrict, FILE *restrict);
82 int fwide(FILE *, int);
83 int fwprintf(FILE *restrict, const wchar_t *restrict, ...);
84 int fwscanf(FILE *restrict, const wchar_t *restrict, ...);
85 wint_t getwc(FILE *);
86 wint_t getwchar(void);
87 int iswalnum(wint_t);
88 int iswalpha(wint_t);
89 int iswcntrl(wint_t);
90 int iswctype(wint_t, wctype_t);
91 int iswdigit(wint_t);
92 int iswgraph(wint_t);
93 int iswlower(wint_t);
94 int iswprint(wint_t);
95 int iswpunct(wint_t);
96 int iswspace(wint_t);
97 int iswupper(wint_t);
98 int iswxdigit(wint_t);
99 size_t mbrlen(const char *restrict, size_t, mbstate_t *restrict);
100 size_t mbrtowc(wchar_t *restrict, const char *restrict, size_t,
101 mbstate_t *restrict);
102 int mbsinit(const mbstate_t *);
103 size_t mbsnrtowcs(wchar_t *restrict, const char **restrict,
104 size_t, size_t, mbstate_t *restrict);
105 size_t mbsrtowcs(wchar_t *restrict, const char **restrict, size_t,
106 mbstate_t *restrict);
107 FILE *open_wmemstream(wchar_t **, size_t *);
108 wint_t putwc(wchar_t, FILE *);
109 wint_t putwchar(wchar_t);
110 int swprintf(wchar_t *restrict, size_t,
111 const wchar_t *restrict, ...);
112 int swscanf(const wchar_t *restrict,
113 const wchar_t *restrict, ...);
114 wint_t towlower(wint_t);
115 wint_t towupper(wint_t);
116 wint_t ungetwc(wint_t, FILE *);
117 int vfwprintf(FILE *restrict, const wchar_t *restrict, va_list);
118 int vfwscanf(FILE *restrict, const wchar_t *restrict, va_list);
119 int vswprintf(wchar_t *restrict, size_t,
120 const wchar_t *restrict, va_list);
121 int vswscanf(const wchar_t *restrict, const wchar_t *restrict,
122 va_list);
123 int vwprintf(const wchar_t *restrict, va_list);
124 int vwscanf(const wchar_t *restrict, va_list);
125 wchar_t *wcpcpy(wchar_t *restrict, const wchar_t *restrict);
126 wchar_t *wcpncpy(wchar_t *restrict, const wchar_t *restrict, size_t);
127 size_t wcrtomb(char *restrict, wchar_t, mbstate_t *restrict);
128 int wcscasecmp(const wchar_t *, const wchar_t *);
129 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
130 wchar_t *wcscat(wchar_t *restrict, const wchar_t *restrict);
131 wchar_t *wcschr(const wchar_t *, wchar_t);
132 int wcscmp(const wchar_t *, const wchar_t *);
133 int wcscoll(const wchar_t *, const wchar_t *);
134 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
135 wchar_t *wcscpy(wchar_t *restrict, const wchar_t *restrict);
136 size_t wcscspn(const wchar_t *, const wchar_t *);
137 wchar_t *wcsdup(const wchar_t *);
138 size_t wcsftime(wchar_t *restrict, size_t,
139 const wchar_t *restrict, const struct tm *restrict);
140 size_t wcslen(const wchar_t *);
141 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
142 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t,
143 locale_t);
144 wchar_t *wcsncat(wchar_t *restrict, const wchar_t *restrict, size_t);
145 int wcsncmp(const wchar_t *, const wchar_t *, size_t);
146 wchar_t *wcsncpy(wchar_t *restrict, const wchar_t *restrict, size_t);
147 size_t wcsnlen(const wchar_t *, size_t);
148 size_t wcsnrtombs(char *restrict, const wchar_t **restrict, size_t,
149 size_t, mbstate_t *restrict);
150 wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
151 wchar_t *wcsrchr(const wchar_t *, wchar_t);
152 size_t wcsrtombs(char *restrict, const wchar_t **restrict,
153 size_t, mbstate_t *restrict);
154 size_t wcsspn(const wchar_t *, const wchar_t *);
155 wchar_t *wcsstr(const wchar_t *restrict, const wchar_t *restrict);
156 double wcstod(const wchar_t *restrict, wchar_t **restrict);
157 float wcstof(const wchar_t *restrict, wchar_t **restrict);
158 wchar_t *wcstok(wchar_t *restrict, const wchar_t *restrict,
159 wchar_t **restrict);
160 long wcstol(const wchar_t *restrict, wchar_t **restrict, int);
161 long double wcstold(const wchar_t *restrict, wchar_t **restrict);
162 long long wcstoll(const wchar_t *restrict, wchar_t **restrict, int);
163 unsigned long wcstoul(const wchar_t *restrict, wchar_t **restrict, int);
164 unsigned long long
165 wcstoull(const wchar_t *restrict, wchar_t **restrict, int);
166 int wcswidth(const wchar_t *, size_t);
167 size_t wcsxfrm(wchar_t *restrict, const wchar_t *restrict, size_t);
168 size_t wcsxfrm_l(wchar_t *restrict, const wchar_t *restrict,
169 size_t, locale_t);
170 int wctob(wint_t);
171 wctype_t wctype(const char *);
172 int wcwidth(wchar_t);
173 wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
174 int wmemcmp(const wchar_t *, const wchar_t *, size_t);
175 wchar_t *wmemcpy(wchar_t *restrict, const wchar_t *restrict, size_t);
176 wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
177 wchar_t *wmemset(wchar_t *, wchar_t, size_t);
178 int wprintf(const wchar_t *restrict, ...);
179 int wscanf(const wchar_t *restrict, ...);
180
181 The following sections are informative.
182
184 The iswblank() function was a late addition to the ISO C standard and
185 was introduced at the same time as the ISO C standard introduced
186 <wctype.h>, which contains all of the isw*() functions. The Open Group
187 Base Specifications had previously aligned with the MSE working draft
188 and had introduced the rest of the isw*() functions into <wchar.h>.
189 For backwards-compatibility, the original set of isw*() functions,
190 without iswblank(), are permitted (as part of the XSI option) in
191 <wchar.h>. For maximum portability, applications should include
192 <wctype.h> in order to obtain declarations for the isw*() functions.
193 This compatibility has been made obsolescent.
194
196 In the ISO C standard, the symbols referenced as XSI extensions are in
197 <wctype.h>. Their presence here is thus an extension.
198
200 None.
201
203 <ctype.h>, <locale.h>, <stdarg.h>, <stddef.h>, <stdint.h>, <stdio.h>,
204 <stdlib.h>, <string.h>, <time.h>, <wctype.h>
205
206 The System Interfaces volume of POSIX.1‐2008, Section 2.2, The Compila‐
207 tion Environment, btowc(), confstr(), fgetwc(), fgetws(), fputwc(),
208 fputws(), fwide(), fwprintf(), fwscanf(), getwc(), getwchar(), iswal‐
209 num(), iswalpha(), iswcntrl(), iswctype(), iswdigit(), iswgraph(),
210 iswlower(), iswprint(), iswpunct(), iswspace(), iswupper(),
211 iswxdigit(), mbrlen(), mbrtowc(), mbsinit(), mbsrtowcs(), open_mem‐
212 stream(), putwc(), putwchar(), towlower(), towupper(), ungetwc(), vfw‐
213 printf(), vfwscanf(), wcrtomb(), wcscasecmp(), wcscat(), wcschr(),
214 wcscmp(), wcscoll(), wcscpy(), wcscspn(), wcsdup(), wcsftime(),
215 wcslen(), wcsncat(), wcsncmp(), wcsncpy(), wcspbrk(), wcsrchr(), wcsr‐
216 tombs(), wcsspn(), wcsstr(), wcstod(), wcstok(), wcstol(), wcstoul(),
217 wcswidth(), wcsxfrm(), wctob(), wctype(), wcwidth(), wmemchr(), wmem‐
218 cmp(), wmemcpy(), wmemmove(), wmemset()
219
220 The Shell and Utilities volume of POSIX.1‐2008, getconf
221
223 Portions of this text are reprinted and reproduced in electronic form
224 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
225 -- Portable Operating System Interface (POSIX), The Open Group Base
226 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
227 cal and Electronics Engineers, Inc and The Open Group. (This is
228 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
229 event of any discrepancy between this version and the original IEEE and
230 The Open Group Standard, the original IEEE and The Open Group Standard
231 is the referee document. The original Standard can be obtained online
232 at http://www.unix.org/online.html .
233
234 Any typographical or formatting errors that appear in this page are
235 most likely to have been introduced during the conversion of the source
236 files to man page format. To report such errors, see https://www.ker‐
237 nel.org/doc/man-pages/reporting_bugs.html .
238
239
240
241IEEE/The Open Group 2013 wchar.h(0P)