mblen

Determines the number of bytes comprising a multibyte character.

Format

#include  <stdlib.h>

int mblen  (const char *s, size_t n);

Arguments

s
A pointer to the multibyte character.
n
The maximum number of bytes that comprise the multibyte character.

Description

If the character is n bytes or less, this function returns the number of bytes comprising the multibyte character pointed to by s. If the character is greater than n bytes, the function returns -1 to indicate an error.

This function is affected by the LC_CTYPE category of the program's current locale.

Return Values
The number of bytes that comprise the multibyte character, if the next n or fewer bytes form a valid character. 
If s is NULL or a pointer to the NULL character. 
-1  Indicates an error occurred. The function sets errno to EILSEQ - Invalid character detected.  


Previous Page | Next Page | Table of Contents | Index