text
stringlengths 0
234
|
---|
.i dest |
by one and |
.i *src |
by the number of bytes consumed. |
the conversion can stop for three reasons: |
.ip 1. 3 |
an invalid multibyte sequence has been encountered. |
in this case, |
.i *src |
is left pointing to the invalid multibyte sequence, |
.i (size_t)\ \-1 |
is returned, |
and |
.i errno |
is set to |
.br eilseq . |
.ip 2. |
.i len |
non-l\(aq\e0\(aq wide characters have been stored at |
.ir dest . |
in this case, |
.i *src |
is left pointing to the next |
multibyte sequence to be converted, |
and the number of wide characters written to |
.i dest |
is returned. |
.ip 3. |
the multibyte string has been completely converted, including the |
terminating null wide character (\(aq\e0\(aq), which has the side |
effect of bringing back |
.i *ps |
to the |
initial state. |
in this case, |
.i *src |
is set to null, and the number of wide |
characters written to |
.ir dest , |
excluding the terminating null wide character, is returned. |
.pp |
if |
.ir dest |
is null, |
.i len |
is ignored, |
and the conversion proceeds as above, |
except that the converted wide characters are not written out to memory, |
and that no length limit exists. |
.pp |
in both of the above cases, |
if |
.i ps |
is null, a static anonymous |
state known only to the |
.br mbsrtowcs () |
function is used instead. |
.pp |
the programmer must ensure that there is room for at least |
.i len |
wide |
characters at |
.ir dest . |
.sh return value |
the |
.br mbsrtowcs () |
function returns the number of wide characters that make |
up the converted part of the wide-character string, not including the |
terminating null wide character. |
if an invalid multibyte sequence was |
encountered, |
.i (size_t)\ \-1 |
is returned, and |
.i errno |
set to |
.br eilseq . |
.sh attributes |
for an explanation of the terms used in this section, see |
.br attributes (7). |
.ad l |
.nh |
.ts |
allbox; |
lb lb lbx |
l l l. |
interface attribute value |
t{ |
.br mbsrtowcs () |
t} thread safety t{ |
mt-unsafe race:mbsrtowcs/!ps |
t} |
.te |
.hy |
.ad |
.sp 1 |
.sh conforming to |
posix.1-2001, posix.1-2008, c99. |
.sh notes |
the behavior of |
.br mbsrtowcs () |
Subsets and Splits