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