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
15 .TH WCSNRTOMBS 3 2021-03-22 "GNU" "Linux Programmer's Manual"
17 wcsnrtombs \- convert a wide-character string to a multibyte string
22 .BI "size_t wcsnrtombs(char *restrict " dest ", const wchar_t **restrict " src ,
23 .BI " size_t " nwc ", size_t " len \
24 ", mbstate_t *restrict " ps );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
35 _POSIX_C_SOURCE >= 200809L
45 except that the number of wide characters to be converted,
60 the wide-character string
62 to a multibyte string starting at
71 The conversion is effectively performed by repeatedly
73 .IR "wcrtomb(dest, *src, ps)" ,
74 as long as this call succeeds,
78 number of bytes written and
81 The conversion can stop for three reasons:
83 A wide character has been encountered that can not be represented as a
84 multibyte sequence (according to the current locale).
87 is left pointing to the invalid wide character,
96 wide characters have been
97 converted without encountering a null wide character (L\(aq\e0\(aq),
98 or the length limit forces a stop.
102 to the next wide character to be converted, and the number of bytes written
107 The wide-character string has been completely converted, including the
108 terminating null wide character (which has the side effect of bringing back
110 to the initial state).
113 is set to NULL, and the number
116 excluding the terminating null byte (\(aq\e0\(aq), is
124 and the conversion proceeds as above,
125 except that the converted bytes are not written out to memory, and that
126 no destination length limit exists.
128 In both of the above cases,
131 is NULL, a static anonymous
132 state known only to the
134 function is used instead.
136 The programmer must ensure that there is room for at least
145 the number of bytes that make up the
146 converted part of multibyte sequence,
147 not including the terminating null byte.
148 If a wide character was encountered which
149 could not be converted,
156 For an explanation of the terms used in this section, see
164 Interface Attribute Value
168 MT-Unsafe race:wcsnrtombs/!ps
186 is not multithread safe.