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
15 .TH MBSNRTOWCS 3 2019-03-06 "GNU" "Linux Programmer's Manual"
17 mbsnrtowcs \- convert a multibyte string to a wide-character string
22 .BI "size_t mbsnrtowcs(wchar_t *" dest ", const char **" src ,
23 .BI " size_t " nms ", size_t " len ", mbstate_t *" ps );
27 Feature Test Macro Requirements for glibc (see
28 .BR feature_test_macros (7)):
37 _POSIX_C_SOURCE\ >=\ 200809L
50 the number of bytes to be converted, starting at
66 to a wide-character string starting at
70 wide characters are written to
75 The conversion is effectively performed by repeatedly
77 .I "mbrtowc(dest, *src, n, ps)"
81 positive number, as long as this call succeeds, and then incrementing
85 by the number of bytes consumed.
87 conversion can stop for three reasons:
89 An invalid multibyte sequence has been encountered.
92 is left pointing to the invalid multibyte sequence,
105 non-L\(aq\e0\(aq wide characters
110 is left pointing to the
111 next multibyte sequence to be converted, and the number of wide characters
116 The multibyte string has been completely converted, including the
117 terminating null wide character (\(aq\e0\(aq)
118 (which has the side effect of bringing back
124 is set to NULL, and the number of wide
125 characters written to
127 excluding the terminating null wide character,
130 According to POSIX.1,
131 if the input buffer ends with an incomplete character,
132 it is unspecified whether conversion stops at the end of
133 the previous character (if any), or at the end of the input buffer.
134 The glibc implementation adopts the former behavior.
140 is ignored, and the conversion proceeds as
141 above, except that the converted wide characters
142 are not written out to memory,
143 and that no destination length limit exists.
145 In both of the above cases, if
147 is NULL, a static anonymous
148 state known only to the
150 function is used instead.
152 The programmer must ensure that there is room for at least
160 function returns the number of wide characters
161 that make up the converted part of the wide-character string,
162 not including the terminating null wide character.
163 If an invalid multibyte sequence was
171 For an explanation of the terms used in this section, see
177 Interface Attribute Value
180 T} Thread safety MT-Unsafe race:mbsnrtowcs/!ps
195 is not multithread safe.