size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
mbrtowc converts a single multi-byte character to a wide character in the current locale.
If s is a null pointer, mbrtowc is equivalent to mbrtowc(NULL, "", 1, ps), ignoring pwc and n.
If s is not null and the object that s points to is a wide-character null character, mbrtowc returns 0.
If s is not null and the object that points to forms a valid multi-byte character with a most n bytes, mbrtowc returns the length in bytes of the multi-byte character and stores that wide character to the object pointed to by pwc (if pwc is not null).
If the object that points to forms an incomplete, but possibly valid, multi-byte character, mbrtowc returns −2. If the object that points to does not form a partial multi-byte character, mbrtowc returns −1.