Section: Linux Programmer's Manual (3)
Return to Main Contents
mbstowcs - convert a multibyte string to a wide-character string
size_t mbstowcs(wchar_t *dest, const char *src, size_t n);
is not a NULL pointer,
function converts the
to a wide-character string starting at
wide characters are written to
The conversion starts
in the initial state.
The conversion can stop for three reasons:
An invalid multibyte sequence has been encountered.
In this case
non-L'\0' wide characters have been stored at
case the number of wide characters written to
is returned, but the
shift state at this point is lost.
The multibyte string has been completely converted, including the
terminating null wide character ('\0').
In this case the number of wide characters written to
excluding the terminating null wide character, is returned.
The programmer must ensure that there is room for at least
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.
In order to avoid the case 2 above, the programmer should make sure
greater or equal to
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
The behavior of
depends on the
category of the
provides a better interface to the same
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 23:53:29 GMT, January 22, 2018