Determines the number of bytes comprising a multibyte character.
#include <wchar.h> size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
mbrtowc(NULL, s, n, ps != NULL ? ps : &internal)
Where internal is the mbstate_t object for the mbrlen function.
If the multibyte character pointed to by s is of n bytes or less, the function returns the number of bytes comprising the character (including any shift sequences).
If either an encoding error occurs or the next n bytes contribute to an incomplete but potentially valid multibyte character, the function returns -1 or -2, respectively.
See also mbrtowc in this section.
x | The number of bytes comprising the multibyte character. |
0 | Indicates that s is a NULL pointer or a pointer to a null byte. |
-1 | Indicates an encoding error, in which case the next n or fewer bytes do not contribute to a complete and valid multibyte character. errno is set to EILSEQ; the conversion state is undefined. |
-2 | Indicates an incomplete but potentially valid multibyte character (all n bytes have been processed). |