.\" Copyright (c) Bruno Haible .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" References consulted: .\" GNU glibc-2 source code and manual .\" Dinkumware C library reference http://www.dinkumware.com/ .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html .\" ISO/IEC 9899:1999 .\" .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya .\" all rights reserved. .\" Translated Tue Jan 11 00:55:41 JST 2000 .\" by HANATAKA Shinya .\" .TH WCSTOMBS 3 1999-07-25 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O wcstombs \- convert a wide-character string to a multibyte string wcstombs \- ワイド文字列をマルチバイト文字列に変換する .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "size_t wcstombs(char *" dest ", const wchar_t *" src ", size_t " n ); .fi .\"O .SH DESCRIPTION .SH 説明 .\"O If \fIdest\fP is not a NULL pointer, the .\"O .BR wcstombs () .\"O function converts .\"O the wide-character string \fIsrc\fP to a multibyte string starting at .\"O \fIdest\fP. .\"O At most \fIn\fP bytes are written to \fIdest\fP. .\"O The conversion .\"O starts in the initial state. .\"O The conversion can stop for three reasons: \fIdest\fP が NULL ポインタでない場合、 .BR wcstombs () 関数は ワイド文字列 \fIsrc\fP を \fIdest\fP から始まるマルチバイト文字列に 変換する。\fIdest\fP には最大で \fIn\fP バイトが書き込まれる。 変換は初期状態で開始される。変換は以下の3つの理由により停止する。 .PP .\"O 1. A wide character has been encountered that can not be represented as a .\"O multibyte sequence (according to the current locale). .\"O In this case .\"O .I (size_t)\ \-1 .\"O is returned. 1. (現在のロケールにおける)マルチバイト列で表現できないワイド文字に 遭遇した場合。この場合には .I (size_t)\ \-1 が返される。 .PP .\"O 2. The length limit forces a stop. .\"O In this case the number of bytes written to .\"O \fIdest\fP is returned, but the shift state at this point is lost. 2. 長さ制限によって強制停止させられた場合。この場合には \fIdest\fP に 書き込まれたバイト数が返される。しかしこの時点でのシフト状態は失われる。 .PP .\"O 3. The wide-character string has been completely converted, including the .\"O terminating L\(aq\\0\(aq. .\"O In this case the conversion ends in the initial state. .\"O The number of bytes written to \fIdest\fP, .\"O excluding the terminating \(aq\\0\(aq byte, is returned. 3. ワイド文字列が終端の L\(aq\\0\(aq を含めて完全に変換された場合。 この場合には変換は初期状態で終り、終端の \(aq\\0\(aq バイトを除いて \fIdest\fP に書き込まれたバイト数を返す。 .PP .\"O The programmer must ensure that there is room for at least \fIn\fP bytes .\"O at \fIdest\fP. プログラマーは \fIdest\fP に最低でも \fIn\fP バイトの空きがあることを 保証しなければならない。 .PP .\"O If \fIdest\fP is NULL, \fIn\fP is ignored, and the conversion proceeds as .\"O above, except that the converted bytes are not written out to memory, .\"O and that no length limit exists. \fIdest\fP が NULL の場合、\fIn\fP は無視される。上記と同様に変換が行 なわれるが変換結果のバイト列はメモリには書き込まれない。 また長さの上限が存在しない。 .PP .\"O In order to avoid the case 2 above, the programmer should make sure \fIn\fP .\"O is greater or equal to \fIwcstombs(NULL,src,0)+1\fP. 上記の 2. の場合を避けるために、プログラマーは \fIn\fP が \fIwcstombs(NULL,src,0)+1\fP 以上であることを保証しなければならない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O The .\"O .BR wcstombs () .\"O function returns the number of bytes that make up the .\"O converted part of multibyte sequence, not including the terminating null byte. .\"O If a wide character was encountered which could not be .\"O converted, .\"O .I (size_t)\ \-1 .\"O is returned. .BR wcstombs () 関数は生成したマルチバイト列のバイト数を返す。終端の ナル文字は含まない。もし変換できないワイド文字に遭遇した場合には .I (size_t)\ \-1 を返す。 .\"O .SH "CONFORMING TO" .SH 準拠 C99. .\"O .SH NOTES .SH 注意 .\"O The behavior of .\"O .BR wcstombs () .\"O depends on the .\"O .B LC_CTYPE .\"O category of the .\"O current locale. .BR wcstombs () の動作は現在のロケールの .B LC_CTYPE カテゴリに依存している。 .PP .\"O The function .\"O .BR wcsrtombs () .\"O provides a thread safe interface to .\"O the same functionality. .BR wcsrtombs () 関数は同じ機能のためのスレッド・セーフな インターフェースを提供する。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR wcsrtombs (3)