Converts a multibyte character array encoded as defined by the LC_CTYPE category of the current locale to a wchar_t array.
#include <stdlib.h> size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
pwcs
A pointer to the wide-character destination of the conversion.
s
A pointer to the multibyte character string to convert.
n
The number of wide characters in pwc.
This function converts a sequence of multibyte characters encoded as defined by the LC_CTYPE category of the current locale from the character array pointed to by s and stores not more than n of the corresponding Unicode characters into the wide character array pointed to by pwcs. No multibyte characters that follow a null character (which is converted into a null wide character) will be examined or converted.
If it encounters an invalidly encoded character, mbstowcs() returns the value (size_t)(-1). Otherwise mbstowcs returns the number of elements of the array pointed to by pwcs modified, not including any terminating null wide character.