1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\" References consulted:
6 .\" GNU glibc-2 source code and manual
7 .\" Dinkumware C library reference http://www.dinkumware.com/
8 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
10 .TH WCSNRTOMBS 3 2021-03-22 "GNU" "Linux Programmer's Manual"
12 wcsnrtombs \- convert a wide-character string to a multibyte string
15 .RI ( libc ", " \-lc )
20 .BI "size_t wcsnrtombs(char *restrict " dest ", const wchar_t **restrict " src ,
21 .BI " size_t " nwc ", size_t " len \
22 ", mbstate_t *restrict " ps );
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
33 _POSIX_C_SOURCE >= 200809L
43 except that the number of wide characters to be converted,
58 the wide-character string
60 to a multibyte string starting at
69 The conversion is effectively performed by repeatedly
71 .IR "wcrtomb(dest, *src, ps)" ,
72 as long as this call succeeds,
76 number of bytes written and
79 The conversion can stop for three reasons:
81 A wide character has been encountered that can not be represented as a
82 multibyte sequence (according to the current locale).
85 is left pointing to the invalid wide character,
94 wide characters have been
95 converted without encountering a null wide character (L\(aq\e0\(aq),
96 or the length limit forces a stop.
100 to the next wide character to be converted, and the number of bytes written
105 The wide-character string has been completely converted, including the
106 terminating null wide character (which has the side effect of bringing back
108 to the initial state).
111 is set to NULL, and the number
114 excluding the terminating null byte (\(aq\e0\(aq), is
122 and the conversion proceeds as above,
123 except that the converted bytes are not written out to memory, and that
124 no destination length limit exists.
126 In both of the above cases,
129 is NULL, a static anonymous
130 state known only to the
132 function is used instead.
134 The programmer must ensure that there is room for at least
143 the number of bytes that make up the
144 converted part of multibyte sequence,
145 not including the terminating null byte.
146 If a wide character was encountered which
147 could not be converted,
154 For an explanation of the terms used in this section, see
162 Interface Attribute Value
166 MT-Unsafe race:wcsnrtombs/!ps
184 is not multithread safe.