{{keywords>wiki library source code example reference}} ===== mbstowcs ===== #include size_t mbstowcs(schar_t *pwcs, const char *str, size_t n); ===== Description ===== mbstowcs converts multibyte characters to wide characters ===== mbstowcs c sourcecode example ===== /* * mbstowcs example code * http://code-reference.com/c/stdlib.h/mbstowcs */ #include #include int main( void ) { char mbinput[8] = "\x54\x65\x73\x74\x20\x31\x32"; wchar_t output[8]; size_t wcssize; wcssize = mbstowcs(output, mbinput, 8); printf("mbstowcs returned %d\n", wcssize); printf("output: 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.4x \n", output[0], output[1], output[2], output[3], output[4], output[5], output[6], output[7]); return 0; } ==== output of mbstowcs example ==== user@host:~/code-reference.com# .//mbstowcs2 mbstowcs returned 7 output: 0x0054 0x0065 0x0073 0x0074 0x0020 0x0031 0x0032