totn C Functions

C Language: mblen function
(Compute Length of Multibyte Character)

In the C Programming Language, the mblen function returns the number of bytes in the multibyte character pointed to by s.

Syntax

The syntax for the mblen function in the C Language is:

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

Parameters or Arguments

s
The multibyte character in which to calculate the number of bytes.
n
The number of bytes that will be examined.

Note

  • If s is a null pointer, the mblen function will initialize the shift state.

Returns

The mblen function examines the first n bytes of s and if it forms a valid character, it returns the number of bytes in s (as limited by n bytes). If it is not, the mblen function returns -1. The mblen function returns zero if s points to a null character.

Required Header

In the C Language, the required header for the mblen function is:

#include <stdlib.h>

Applies To

In the C Language, the mblen function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the mblen function:

See Also

Other C functions that are noteworthy when dealing with the mblen function: