Is there an equivalent C function mbsinvalid on Linux?
Porting C applications from AIX to Linux – Does anyone know if there is an equivalent mbsinvalid() function on Linux?
From the AIX page:
The mbsinvalid subroutine examines the string pointed to by the S parameter to determine the validity of the character. The LC_CTYPE category affects the behavior of the mbsinvalid subroutine. ”
mbstowcs with NULL destination pointers:
If dest is NULL, n is ignored, and the conversion proceeds as above, except that the converted wide characters are not written out to memory, and that no length limit exists.
- An invalid multibyte sequence has been encountered. In this case (size_t) -1 is returned.
(from mbstowcs man page).
the result of (size_t)-1 means that there is an invalid multibyte sequence.