mblenのヘルプ・マニュアル
日本語 英語
mblen --help
man mblen
MBLEN(3) Linux Programmer’s Manual MBLEN(3)
名前
mblen - 次のマルチバイト文字のバイト数を返す
書式
#include
int mblen(const char *s, size_t n);
説明
s が NULL ポインターでなければ、 mblen() 関数は s から始まる最大 n バイ
トのマルチバイト文字列を検査して、次の完全なマルチバイト文字を取り出 す
。これには mblen() 関数のみが使用する静的で名前のないシフト状態が使用さ
れる。マルチバイト文字がナルワイド文字でなければ s から消費されるバイト
数を返す。マルチバイト文字がナルワイド文字ならば 0 を返す。
s か ら 始 ま る n バイトが完全なマルチバイト文字を含んでいなければ、
mblen() は -1 を返す。マルチバイト文字列に冗長なシフトシーケンスが含 ま
れていると、 n が MB_CUR_MAX 以上の場合にもこのようなことが起こりえる。
s から始まるマルチバイト文字列が次の完全な文字の前に不正なマルチバイ ト
列を含んでいる場合にも、 mblen() は -1 を返す。
s が NULL ポインターならば、 mblen() 関数はこの関数のみが使用するシフト
状態を初期化状態に戻し、シフト状態を使用した文字符号の場合にはゼロ以 外
を、文字符号がシフト状態を持たない場合にはゼロを返す。
返り値
mblen() 関数は s から始まるマルチバイト列を検査してナルワイド文字以外を
確認した場合にはそのバイト数を返す。ナルワイド文字を確認した場合には ゼ
ロ を返す。不正なマルチバイト列に遭遇した場合や完全なマルチバイト文字を
解析できなかった場合には -1 を返す。
準拠
C99.
注意
mblen() の動作は現在のロケールの LC_CTYPE カテゴリに依存している。
mbrlen(3) 関数は同じ機能のより良いインタフェースを提供する。
関連項目
mbrlen(3)
GNU 1999-07-25 MBLEN(3)
MBLEN(3) Linux Programmer’s Manual MBLEN(3)
NAME
mblen - determine number of bytes in next multibyte character
SYNOPSIS
#include
int mblen(const char *s, size_t n);
DESCRIPTION
If s is not a NULL pointer, the mblen() function inspects at most n
bytes of the multibyte string starting at s and extracts the next com-
plete multibyte character. It uses a static anonymous shift state only
known to the mblen() function. If the multibyte character is not the
null wide character, it returns the number of bytes that were consumed
from s. If the multibyte character is the null wide character, it
returns 0.
If the n bytes starting at s do not contain a complete multibyte char-
acter, mblen() returns -1. This can happen even if n is greater than
or equal to MB_CUR_MAX, if the multibyte string contains redundant
shift sequences.
If the multibyte string starting at s contains an invalid multibyte
sequence before the next complete character, mblen() also returns -1.
If s is a NULL pointer, the mblen() function resets the shift state,
only known to this function, to the initial state, and returns non-zero
if the encoding has nontrivial shift state, or zero if the encoding is
stateless.
RETURN VALUE
The mblen() function returns the number of bytes parsed from the multi-
byte sequence starting at s, if a non-null wide character was recog-
nized. It returns 0, if a null wide character was recognized. It
returns -1, if an invalid multibyte sequence was encountered or if it
couldn’t parse a complete multibyte character.
CONFORMING TO
C99.
NOTES
The behavior of mblen() depends on the LC_CTYPE category of the current
locale.
The function mbrlen(3) provides a better interface to the same func-
tionality.
SEE ALSO
mbrlen(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 1999-07-25 MBLEN(3)