Standard C++ Library Reference ISO/IEC (VERSION3)
mblen
int mblen(const char *s, size_t n);
If s is not a null pointer, the function returns the number of bytes in the multibyte string s that
constitute the next multibyte character, or it returns -1 if the next n (or the remaining) bytes do
not constitute a valid multibyte character. mblen does not include the terminating null in the
count of bytes. The function can use a conversion state stored in an internal static-duration
object to determine how to interpret the multibyte string.
If s is a null pointer and if multibyte characters have a state-dependent encoding in the current
locale, the function stores the initial conversion state in its internal static-duration object and
returns nonzero; otherwise, it returns zero.
mbstowcs
size_t mbstowcs(wchar_t *wcs, const char *s, size_t n);
The function stores a wide character string, in successive elements of the array whose first
element has the address wcs, by converting, in turn, each of the multibyte characters in the
multibyte string s. The string begins in the initial conversion state. The function converts each
character as if by calling mbtowc (except that the internal conversion state stored for that
function is unaffected). It stores at most n wide characters, stopping after it stores a null wide
character. It returns the number of wide characters it stores, not counting the null wide
character, if all conversions are successful; otherwise, it returns -1.
mbtowc
int mbtowc(wchar_t *pwc, const char *s, size_t n);
If s is not a null pointer, the function determines x, the number of bytes in the multibyte string
s that constitute the next multibyte character. (x cannot be greater than MB_CUR_MAX.) If pwc
is not a null pointer, the function converts the next multibyte character to its corresponding
wide-character value and stores that value in *pwc. It then returns x, or it returns -1 if the next
n or the remaining bytes do not constitute a valid multibyte character. mbtowc does not
include the terminating null in the count of bytes. The function can use a conversion state stored
in an internal static-duration object to determine how to interpret the multibyte string.
If s is a null pointer and if multibyte characters have a state-dependent encoding in the current
locale, the function stores the initial conversion state in its internal static-duration object and
returns nonzero; otherwise, it returns zero.