mblen function(Compute Length of Multibyte Character) in C Language – example and detail

In the C Programming Language, the mblen characteristic returns the quantity of bytes in the multibyte persona pointed to with the aid of s.

Syntax

The syntax for the mblen feature 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 range of bytes that will be examined.

Note If s is a null pointer, the mblen feature will initialize the shift state.

Returns

The mblen characteristic examines the first n bytes of s and if it varieties a valid character, it returns the variety of bytes in s (as confined via n bytes). If it is not, the mblen feature returns -1. The mblen feature returns zero if s factors 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 characteristic can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the mblen function:

mbtowc characteristic wctomb function

See Also

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

mbstowcs function setlocale characteristic wcstombs function