#include <stdlib.h>int mbtowc(wchar_t *out, const char *in, size_t size);
The mbtowc( ) function converts the multibyte character in the array pointed to by in into its wide-character equivalent and puts that result in the object pointed to by out. Only size number of characters will be examined.
In C99, out and in are qualified by restrict.
This function returns the number of bytes that are put into out. –1 is returned if an error occurs. If in is null, then mbtowc( ) returns nonzero if multibyte characters have state-dependent encodings. If they do not, zero is returned.
Related functions are mblen( ) and wctomb( ).