mbrlen
From cppreference.com
Defined in header <wchar.h>
|
||
(since C95) | ||
(since C99) | ||
Determines the size, in bytes, of the representation of a multibyte character.
This function is equivalent to the call mbrtowc(nullptr, s, n, ps?ps:&internal) for some hidden object internal
of type mbstate_t, except that the expression ps
is evaluated only once.
Parameters
s | - | pointer to an element of a multibyte character string |
n | - | limit on the number of bytes in s that can be examined |
ps | - | pointer to the variable holding the conversion state |
Return value
The first of the following that applies:
- 0 if the next
n
or fewer bytes complete the null character or ifs
is a null pointer. Both cases reset the conversion state. - the number of bytes [1...n] that complete a valid multibyte character
- (size_t)-2 if the next
n
bytes are part of a possibly valid multibyte character, which is still incomplete after examining alln
bytes - (size_t)-1 if encoding error occurs. The value of errno is
EILSEQ
; the conversion state is unspecified.