function

mbstowcs

<cstdlib>
size_t mbstowcs ( wchar_t * dest, const char * src, size_t max );
Convert multibyte string to wide-character string
Translates up to max characters of the C multibyte string pointed by src to their wide-character equivalents and stores them in the buffer pointed by dest, stopping if a terminating null character is encountered (which is also translated and stored, but not counted in the length returned by the function).

The behavior of this function depends on the LC_CTYPE category of the selected C locale.

Parameters

dest
Pointer to an array of wchar_t elements long enough to store a wide string of max wide characters.
src
C multibyte character string to be interpreted.
max
Maximum number of wchar_t characters to write to dest.
size_t is an unsigned integral type.

Return Value

The number of wide characters written to dest, not including the ending null-character.
If an invalid multibyte character is encountered, a (size_t)-1 value is returned.
Notice that size_t is an unsigned integral type, and thus none of the values possibly returned is less than zero.

See also