Section (3) wcsnrtombs
wcsnrtombs — convert a wide-character string to a multibyte string
|const wchar_t **src,|
wcsnrtombs() function is
like the wcsrtombs(3) function,
except that the number of wide characters to be converted,
starting at *
dest is not
converts at most
wide characters from the wide-character string *
src to a multibyte string
len bytes are
shift state *
updated. The conversion is effectively performed by
repeatedly calling wcrtomb(dest,
*src, ps), as long as this call succeeds, and
dest by the number of bytes
written and *
one. The conversion can stop for three reasons:
A wide character has been encountered that can not be represented as a multibyte sequence (according to the current locale). In this case, *
srcis left pointing to the invalid wide character, (size_t) −1 is returned, and
errnois set to EILSEQ.
nwcwide characters have been converted without encountering a null wide character (L_zsingle_quotesz_ _zsingle_quotesz_), or the length limit forces a stop. In this case, *
srcis left pointing to the next wide character to be converted, and the number of bytes written to
The wide-character string has been completely converted, including the terminating null wide character (which has the side effect of bringing back *
psto the initial state). In this case, *
srcis set to NULL, and the number of bytes written to
dest, excluding the terminating null byte (_zsingle_quotesz_ _zsingle_quotesz_), is returned.
dest is NULL,
len is ignored, and
the conversion proceeds as above, except that the converted
bytes are not written out to memory, and that no destination
length limit exists.
In both of the above cases, if
ps is NULL, a static anonymous
state known only to the
wcsnrtombs() function is used instead.
The programmer must ensure that there is room for at least
len bytes at
returns the number of bytes that make up the converted part
of multibyte sequence, not including the terminating null
byte. If a wide character was encountered which could not be
−1 is returned, and
errno set to EILSEQ.
For an explanation of the terms used in this section, see attributes(7).
||Thread safety||MT-Unsafe race:wcsnrtombs/!ps|
The behavior of
depends on the
category of the current locale.
Passing NULL as
is not multithread safe.
This page is part of release 5.04 of the Linux
man-pages project. A
description of the project, information about reporting bugs,
and the latest version of this page, can be found at
Copyright (c) Bruno Haible <haibleclisp.cons.org>
This is free documentation; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
GNU glibc-2 source code and manual
Dinkumware C library reference http://www.dinkumware.com/
OpenGroup_zsingle_quotesz_s Single UNIX specification http://www.UNIX-systems.org/online.html