Determines the length of a multibyte character and saves the parse state #include <stdlib.h> size_t mbrlen ( const char * restrict s , size_t maxsize , mbstate_t * restrict state ); The mbrlen( ) function, like mblen( ), determines the length in bytes of a multibyte character referenced by its first argument. Its additional parameter, a pointer to an mbstate_t object, describes the parse state (also called the shift state) of a multibyte character sequence in the given encoding. mbrlen( ) updates this parse-state object after analyzing the multibyte character in the string, so that you can use it in a subsequent function call to interpret the next character correctly. (Hence the additional "r" in the function name, which stands for "restartable.") If the final argument is a null pointer, mbrlen( ) uses an internal, static mbstate_t object. The possible return values are as follows:
The LC_TYPE category in the current locale settings determines which byte sequences are valid multibyte characters. ExampleSee the example for mblen( ) in this chapter. See Also |