size_t mbrtowc_l(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, locale_t loc);
mbrtowc_l converts a single multi-byte character to a wide character in the locale loc.
If s is a null pointer, mbrtowc_l 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_l 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_l 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_l returns −2. If the object that points to does not form a partial multi-byte character, mbrtowc_l returns −1.