2 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\" References consulted:
7 .\" GNU glibc-2 source code and manual
8 .\" Dinkumware C library reference http://www.dinkumware.com/
9 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
11 .TH mbsnrtowcs 3 (date) "Linux man-pages (unreleased)"
13 mbsnrtowcs \- convert a multibyte string to a wide-character string
16 .RI ( libc ", " \-lc )
21 .BI "size_t mbsnrtowcs(wchar_t " dest "[restrict ." len "], const char **restrict " src ,
22 .BI " size_t " nms ", size_t " len \
23 ", mbstate_t *restrict " ps );
27 Feature Test Macro Requirements for glibc (see
28 .BR feature_test_macros (7)):
34 _POSIX_C_SOURCE >= 200809L
44 the number of bytes to be converted, starting at
60 to a wide-character string starting at
64 wide characters are written to
69 The conversion is effectively performed by repeatedly
71 .I "mbrtowc(dest, *src, n, ps)"
75 positive number, as long as this call succeeds, and then incrementing
79 by the number of bytes consumed.
81 conversion can stop for three reasons:
83 An invalid multibyte sequence has been encountered.
86 is left pointing to the invalid multibyte sequence,
99 non-L\[aq]\e0\[aq] wide characters
104 is left pointing to the
105 next multibyte sequence to be converted, and the number of wide characters
110 The multibyte string has been completely converted, including the
111 terminating null wide character (\[aq]\e0\[aq])
112 (which has the side effect of bringing back
118 is set to NULL, and the number of wide
119 characters written to
121 excluding the terminating null wide character,
124 According to POSIX.1,
125 if the input buffer ends with an incomplete character,
126 it is unspecified whether conversion stops at the end of
127 the previous character (if any), or at the end of the input buffer.
128 The glibc implementation adopts the former behavior.
134 is ignored, and the conversion proceeds as
135 above, except that the converted wide characters
136 are not written out to memory,
137 and that no destination length limit exists.
139 In both of the above cases, if
141 is NULL, a static anonymous
142 state known only to the
144 function is used instead.
146 The programmer must ensure that there is room for at least
154 function returns the number of wide characters
155 that make up the converted part of the wide-character string,
156 not including the terminating null wide character.
157 If an invalid multibyte sequence was
165 For an explanation of the terms used in this section, see
171 Interface Attribute Value
179 MT-Unsafe race:mbsnrtowcs/!ps
194 is not multithread safe.