mbrlen function — Gets number of bytes in a multibyte character
size_t mbrlen(const char* str, size_t n, mbstate_t* ps)
The mbrlen
function counts
the number of bytes needed to complete the next multibyte character
that str
points to. At most,
n
bytes of str
are examined.
The ps
parameter points to
the shift state, which keeps track of the conversion state between
calls to mbrlen
. If ps
is a null pointer, an internal shift
state is used (which is similar to calling mblen
in <cstdlib>
).
The return value is one of the following:
0
If the multibyte character represents the null wide character
static_cast<size_t>(-1)
If str
does not point
to a valid multibyte character
static_cast<size_t>(-2)
If n
is too
small
If the multibyte character is valid, in which case the value returned is the number of bytes in the multibyte character