The mbrlen function is equivalent to the call: 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.