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
12 .TH mbsrtowcs 3 (date) "Linux man-pages (unreleased)"
14 mbsrtowcs \- convert a multibyte string to a wide-character string
17 .RI ( libc ", " \-lc )
22 .BI "size_t mbsrtowcs(wchar_t " dest "[restrict ." len "], const char **restrict " src ,
23 .BI " size_t " len ", mbstate_t *restrict " ps );
33 to a wide-character string starting at
37 wide characters are written to
42 The conversion is effectively performed by repeatedly
44 .I "mbrtowc(dest, *src, n, ps)"
48 positive number, as long as this call succeeds, and then incrementing
52 by the number of bytes consumed.
53 The conversion can stop for three reasons:
55 An invalid multibyte sequence has been encountered.
58 is left pointing to the invalid multibyte sequence,
67 non-L\[aq]\e0\[aq] wide characters have been stored at
71 is left pointing to the next
72 multibyte sequence to be converted,
73 and the number of wide characters written to
77 The multibyte string has been completely converted, including the
78 terminating null wide character (\[aq]\e0\[aq]), which has the side
79 effect of bringing back
85 is set to NULL, and the number of wide
88 excluding the terminating null wide character, is returned.
95 and the conversion proceeds as above,
96 except that the converted wide characters are not written out to memory,
97 and that no length limit exists.
99 In both of the above cases,
102 is NULL, a static anonymous
103 state known only to the
105 function is used instead.
107 The programmer must ensure that there is room for at least
115 function returns the number of wide characters that make
116 up the converted part of the wide-character string, not including the
117 terminating null wide character.
118 If an invalid multibyte sequence was
126 For an explanation of the terms used in this section, see
134 Interface Attribute Value
138 MT-Unsafe race:mbsrtowcs/!ps
145 POSIX.1-2001, POSIX.1-2008, C99.
156 is not multithread safe.