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
16 .TH MBSRTOWCS 3 2021-03-22 "GNU" "Linux Programmer's Manual"
18 mbsrtowcs \- convert a multibyte string to a wide-character string
23 .BI "size_t mbsrtowcs(wchar_t *restrict " dest ", const char **restrict " src ,
24 .BI " size_t " len ", mbstate_t *restrict " ps );
34 to a wide-character string starting at
38 wide characters are written to
43 The conversion is effectively performed by repeatedly
45 .I "mbrtowc(dest, *src, n, ps)"
49 positive number, as long as this call succeeds, and then incrementing
53 by the number of bytes consumed.
54 The conversion can stop for three reasons:
56 An invalid multibyte sequence has been encountered.
59 is left pointing to the invalid multibyte sequence,
68 non-L\(aq\e0\(aq wide characters have been stored at
72 is left pointing to the next
73 multibyte sequence to be converted,
74 and the number of wide characters written to
78 The multibyte string has been completely converted, including the
79 terminating null wide character (\(aq\e0\(aq), which has the side
80 effect of bringing back
86 is set to NULL, and the number of wide
89 excluding the terminating null wide character, is returned.
96 and the conversion proceeds as above,
97 except that the converted wide characters are not written out to memory,
98 and that no length limit exists.
100 In both of the above cases,
103 is NULL, a static anonymous
104 state known only to the
106 function is used instead.
108 The programmer must ensure that there is room for at least
116 function returns the number of wide characters that make
117 up the converted part of the wide-character string, not including the
118 terminating null wide character.
119 If an invalid multibyte sequence was
127 For an explanation of the terms used in this section, see
135 Interface Attribute Value
139 MT-Unsafe race:mbsrtowcs/!ps
146 POSIX.1-2001, POSIX.1-2008, C99.
157 is not multithread safe.