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 wcsrtombs 3 (date) "Linux man-pages (unreleased)"
14 wcsrtombs \- convert a wide-character string to a multibyte string
17 .RI ( libc ", " \-lc )
22 .BI "size_t wcsrtombs(char " dest "[restrict ." len "], \
23 const wchar_t **restrict " src ,
24 .BI " size_t " len ", mbstate_t *restrict " ps );
33 the wide-character string
35 to a multibyte string starting at
44 The conversion is effectively performed by repeatedly
46 .IR "wcrtomb(dest, *src, ps)" ,
47 as long as this call succeeds,
51 number of bytes written and
54 The conversion can stop for three reasons:
56 A wide character has been encountered that can not be represented as a
57 multibyte sequence (according to the current locale).
60 is left pointing to the invalid wide character,
68 The length limit forces a stop.
72 to the next wide character to be converted,
73 and the number of bytes written to
77 The wide-character string has been completely converted, including the
78 terminating null wide character (L\[aq]\e0\[aq]),
79 which has the side effect of bringing back
84 is set to NULL, and the number
87 excluding the terminating null byte (\[aq]\e0\[aq]),
95 and the conversion proceeds as above, except that the converted bytes
96 are not written out to memory, and that
97 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
116 the number of bytes that make up the
117 converted part of multibyte sequence,
118 not including the terminating null byte.
119 If a wide character was encountered
120 which could not be converted,
127 For an explanation of the terms used in this section, see
135 Interface Attribute Value
139 MT-Unsafe race:wcsrtombs/!ps
146 POSIX.1-2001, POSIX.1-2008, C99.
157 is not multithread safe.