Count the bytes in a multibyte character (restartable)
#include <wchar.h> size_t mbrlen( const char * s, size_t n, mbstate_t * ps);
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mbrlen() function counts the bytes in the multibyte character pointed to by s, to a maximum of n bytes.
- The resulting conversion state indicates an incomplete multibyte character after all n characters were converted.
- The function detected an encoding error before completing the next multibyte character, in which case the function errno to EILSEQ and leaves the resulting conversion state undefined.
- The next completed character is a null character, in which case the resulting conversion state is the initial conversion state.
- The number of bytes needed to complete the next multibyte character, in which case the resulting conversion state indicates that x bytes have been converted.
- Invalid character sequence.
- The ps argument points to an invalid object.