Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mblen(3) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mbtowc(3)

wctomb(3)

mbstowcs(3)

wcstombs(3)

mblen(3)  —  Subroutines

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 locales with shift-state character encoding, a call to mblen() with a null pointer as the mbs parameter, places the function in the initial shift state. A call to mblen() with an mbs parameter that is not a null pointer, may change the shift state for subsequent calls to mblen(), depending on the character examined.  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 is not a null pointer, the mblen() function returns a value determined as follows:

       •If mbs points to a valid multibyte character other than the null character, 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 a value of 0 (zero). 

       •If mbs does not point to a valid multibyte character or points to a character of more than n bytes, mblen() returns a value of -1 and sets errno to indicate the error. 

If the mbs parameter is a null pointer, the return value depends on whether the character encoding in the current locale is shift-state dependent. 

       •If the character encoding is shift-state dependent, mblen() returns a nonzero value. 

       •If the character encoding is not shift-state dependent, mblen() returns a value of 0 (zero). 

ERRORS

If the following condition occurs, the mblen() function sets errno to the corresponding value. 

[EILSEQ]The mbs parameter points to an invalid multibyte character or the number of bytes in the character is greater than the value of the n parameter. 

RELATED INFORMATION

Functions: mbtowc(3), wctomb(3), mbstowcs(3), wcstombs(3). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026