mblen(3) — Subroutines
OSF
NAME
mblen − Determines the length in bytes of a multibyte character
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <stdlib.h> int mblen(
const char ∗mbs,
size_t n) ;
PARAMETERS
mbsPoints to a multibyte character string.
nSpecifies the maximum number of bytes to consider.
DESCRIPTION
The mblen() function determines the number of bytes in a multibyte character. The behavior of the mblen() function is affected by the LC_CTYPE category of the current locale. In environments with shift-state dependent encoding, calls to mblen() with a null value for the mbs parameter place the function in the initial shift state. Subsequent calls with the mbs parameter set to nonnull values alter the state of the function as necessary. Changing the LC_CTYPE category of the locale causes the shift state of the function to be indeterminate.
The implementation behaves as though no other function calls the mblen() function.
NOTES
AES Support Level:
Full use
RETURN VALUES
If the mbs parameter does not have a null pointer value, the mblen() function returns a value determined as follows:
•If mbs points to a valid multibyte character other than null, mblen() returns the number of bytes in the character unless the number of bytes is greater than n.
•If mbs points to the null character, mblen() returns 0 (zero).
•If mbs does not point to a valid multibyte character or points to a character of more than n bytes, mblen() returns -1 and sets errno to indicate the error.
When the mbs parameter is a null pointer, the return value depends on the environment, as follows:
•In environments where encoding is not shift-state dependent, mblen() returns 0 (zero).
•In environments where encoding is shift-state dependent, mblen() returns a nonzero value.
ERRORS
If the mblen() function fails, errno may be set to the following value:
[EINVAL]The mbs parameter points to an invalid multibyte character.
RELATED INFORMATION
Functions: mbtowc(3), wctomb(3), mbstowcs(3), wcstombs(3)