wctombのヘルプ・マニュアル
日本語 英語
wctomb --help
man wctomb
WCTOMB(3) Linux Programmer’s Manual WCTOMB(3)
名前
wctomb - ワイド文字をマルチバイト列に変換する。
書式
#include
int wctomb(char *s, wchar_t wc);
説明
s が NULL でなければ、 wctomb() 関数はワイド文字 wc をマルチバイト表現
に変換して s の指す文字配列に格納する。同時に wctomb 関数のみが使用する
静 的で名前のないシフト状態を更新する。この関数はマルチバイト表現の長さ
、すなわち s に書き込まれたバイト数を返す。プログラマーは s に少なく と
も MB_CUR_MAX バイトの空きがあることを保証しなければならない。
s が NULL ならば、 wctomb() 関数は自分のみが使用するシフト状態を初期状
態に戻して、文字符号がシフト状態に依存しているならばゼロ以外をシフト 状
態に依存しない場合にはゼロを返す。
返り値
s が NULL でない場合 wctomb() 関数はバイト配列 s に書き込まれたバイト数
を返す。wc が(現在のロケールにおいて) マルチバイト列で表現できない場 合
には -1 を返す。
s が NULL の場合 wctomb() 関数は文字符号がシフト状態に依存している場合
にはゼロ以外、シフト状態に依存しない場合はゼロを返す。
準拠
C99.
注意
wctomb() 関数の動作は現在のロケールの LC_CTYPE カテゴリに依存している。
こ の関数はマルチスレッドでは安全ではない。 wcrtomb(3) 関数は同じ機能の
より良いインターフェースを提供する。
関連項目
MB_CUR_MAX(3), wcrtomb(3), wcstombs(3)
GNU 1999-07-25 WCTOMB(3)
WCTOMB(3) Linux Programmer’s Manual WCTOMB(3)
NAME
wctomb - convert a wide character to a multibyte sequence
SYNOPSIS
#include
int wctomb(char *s, wchar_t wc);
DESCRIPTION
If s is not NULL, the wctomb() function converts the wide character wc
to its multibyte representation and stores it at the beginning of the
character array pointed to by s. It updates the shift state, which is
stored in a static anonymous variable only known to the wctomb func-
tion, and returns the length of said multibyte representation, that is,
the number of bytes written at s.
The programmer must ensure that there is room for at least MB_CUR_MAX
bytes at s.
If s is NULL, the wctomb() 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 state-
less.
RETURN VALUE
If s is not NULL, the wctomb() function returns the number of bytes
that have been written to the byte array at s. If wc can not be repre-
sented as a multibyte sequence (according to the current locale), -1 is
returned.
If s is NULL, the wctomb() function returns non-zero if the encoding
has nontrivial shift state, or zero if the encoding is stateless.
CONFORMING TO
C99.
NOTES
The behavior of wctomb() depends on the LC_CTYPE category of the cur-
rent locale.
This function is not multithread safe. The function wcrtomb(3) pro-
vides a better interface to the same functionality.
SEE ALSO
MB_CUR_MAX(3), wcrtomb(3), wcstombs(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 WCTOMB(3)