1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
15 .\" all rights reserved.
16 .\" Translated Tue Jan 11 00:55:36 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
19 .TH WPRINTF 3 2011-09-17 "GNU" "Linux Programmer's Manual"
22 .\"O wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- formatted
23 .\"O wide-character output conversion
24 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- ワイド文字を
32 .BI "int wprintf(const wchar_t *" format ", ...);"
33 .BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
34 .BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
35 .BI " const wchar_t *" format ", ...);"
37 .BI "int vwprintf(const wchar_t *" format ", va_list " args );
38 .BI "int vfwprintf(FILE *" stream ", const wchar_t *" format ", va_list " args );
39 .BI "int vswprintf(wchar_t *" wcs ", size_t " maxlen ,
40 .BI " const wchar_t *" format ", va_list " args );
44 .\"O Feature Test Macro Requirements for glibc (see
45 .\"O .BR feature_test_macros (7)):
47 .RB ( feature_test_macros (7)
52 .\"O All functions shown above:
61 _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE ||
63 _ISOC95_SOURCE /* Since glibc 2.12 */ ||
65 _POSIX_C_SOURCE\ >=\ 200112L;
75 .\"O family of functions is
76 .\"O the wide-character equivalent of the
78 .\"O family of functions.
79 .\"O It performs formatted output of wide
85 ワイド文字版である。これらはワイド文字をフォーマットして出力する。
92 .\"O perform wide-character output to \fIstdout\fP.
93 .\"O \fIstdout\fP must not be byte oriented; see
95 .\"O for more information.
99 関数は \fIstdout\fP に出力を行なう。
100 \fIstdout\fP がバイト単位入出力であってはいけない。より詳しい説明は
107 .\"O .BR vfwprintf ()
109 .\"O perform wide-character output to \fIstream\fP.
110 .\"O \fIstream\fP must not be byte oriented; see
112 .\"O for more information.
116 関数は \fIstream\fP にワイド文字出力
117 を行なう。 \fIstream\fP がバイト単位入出力であってはいけない。
125 .\"O .BR vswprintf ()
127 .\"O perform wide-character output
128 .\"O to an array of wide characters.
129 .\"O The programmer must ensure that there is
130 .\"O room for at least \fImaxlen\fP wide
131 .\"O characters at \fIwcs\fP.
136 ワイド文字出力を行なう。プログラマーは \fIwcs\fP に最低でも
137 \fImaxlen\fP 文字のワイド文字を出力できる空きがあることを保証しなければ
140 .\"O These functions are like
143 .\"O .BR vprintf (3),
144 .\"O .BR fprintf (3),
145 .\"O .BR vfprintf (3),
146 .\"O .BR sprintf (3),
147 .\"O .BR vsprintf (3)
148 .\"O functions except for the
149 .\"O following differences:
161 .\"O The \fIformat\fP string is a wide character string.
162 \fIformat\fP がワイド文字列で与えられる。
165 .\"O The output consists of wide characters, not bytes.
166 出力がバイトではなくワイド文字で構成される。
171 .\"O .BR vswprintf ()
172 .\"O take a \fImaxlen\fP argument,
175 .\"O .BR vsprintf (3)
177 .\"O .RB ( snprintf (3)
179 .\"O .BR vsnprintf (3)
180 .\"O take a \fImaxlen\fP argument, but these functions do not return \-1 upon
181 .\"O buffer overflow on Linux.)
185 は \fImaxlen\fP 引き数を取るが、
193 は \fImaxlen\fP 引き数を取るが
194 これらの関数が Linux では、バッファーが溢れた場合でも \-1 を返さない)。
196 .\"O The treatment of the conversion characters \fBc\fP and \fBs\fP is different:
197 \fBc\fP と \fBs\fP 変換文字の扱いが異っている:
202 .\"O modifier is present, the
204 .\"O argument is converted to a wide character by a call to the
206 .\"O function, and the resulting wide character is written.
209 .\"O modifier is present, the
211 .\"O (wide character) argument is written.
219 関数によってワイド文字に変換される。そして結果のワイド文字が出力される。
227 .\"O modifier is present: The
228 .\"O .I "const\ char\ *"
229 .\"O argument is expected to be a pointer to an array of character type
230 .\"O (pointer to a string) containing a multibyte character sequence beginning
231 .\"O in the initial shift state.
232 .\"O Characters from the array are converted to
233 .\"O wide characters (each by a call to the
235 .\"O function with a conversion state starting in the initial state before
236 .\"O the first byte).
237 .\"O The resulting wide characters are written up to
238 .\"O (but not including) the terminating null wide character.
239 .\"O If a precision is
240 .\"O specified, no more wide characters than the number specified are written.
241 .\"O Note that the precision determines the number of
242 .\"O .I wide characters
243 .\"O written, not the number of
246 .\"O .IR "screen positions" .
253 引き数は初期状態より始まるマルチバイト文字列を含んだ
254 char 型の配列へのポインター(文字列へのポインター)とみなされる。
255 配列の文字は(最初のバイト前に初期状態で変換を開始し、それぞれの文字を
257 関数によって)ワイド文字へと変換される。結果のワイド文字は終端の
258 ナルワイド文字の手前までが書き込まれる。精度(precision)が指定された
259 場合、指定された数字を超えるワイド文字は書き込まれない。精度は
267 .\"O The array must contain a terminating null byte, unless a precision is given
268 .\"O and it is so small that the number of converted wide characters reaches it
269 .\"O before the end of the array is reached.
272 .\"O modifier is present: The
273 .\"O .I "const\ wchar_t\ *"
274 .\"O argument is expected to be a pointer to an array of wide characters.
275 .\"O Wide characters from the array are written up to (but not including) a
276 .\"O terminating null wide character.
277 .\"O If a precision is specified, no more than
278 .\"O the number specified are written.
279 .\"O The array must contain a terminating null
280 .\"O wide character, unless a precision is given and it is smaller than or equal
281 .\"O to the number of wide characters in the array.
282 精度がない場合には配列の終端にナル文字を含む必要がある。
283 精度を指定する場合には、配列の最後に到着する前に変換されたワイド文字の
284 数がそれに到達するよう、精度は十分に小さな数でなければならない。
288 .I "const\ wchar_t\ *"
289 引き数はワイド文字の配列へのポインターとみなされる。
290 配列のワイド文字列は終端のナルワイド文字の手間まで出力される。
291 もし精度が指定された場合には指定された精度以上の文字は出力されない。
292 精度を指定しない場合には終端のナルワイド文字を含む必要がある。
293 精度を指定する場合にはそれはワイド文字の配列の大きさよりも小さくな
295 .\"O .SH "RETURN VALUE"
297 .\"O The functions return the number of wide characters written, excluding the
298 .\"O terminating null wide character in
299 .\"O case of the functions
302 .\"O .BR vswprintf ().
303 .\"O They return \-1 when an error occurs.
304 これらの関数は書き込まれたワイド文字の文字数を返す。
309 終端のナルワイド文字は含まない。エラーが起こった場合は \-1 を返す。
310 .\"O .SH "CONFORMING TO"
327 .\"O If the \fIformat\fP string contains non-ASCII wide characters, the program
328 .\"O will only work correctly if the
330 .\"O category of the current locale at
331 .\"O run time is the same as the
333 .\"O category of the current locale at
335 .\"O This is because the
336 \fIformat\fP 文字列が ASCII 以外のワイド文字を含んでいる場合、
342 一致している場合にのみプログラムは正常に動作する。これは
344 .\"O representation is platform- and locale- dependent.
345 .\"O (The glibc represents
346 .\"O wide characters using their Unicode (ISO-10646) code point, but other
347 .\"O platforms don't do this.
348 .\"O Also, the use of ISO C99 universal character names
349 .\"O of the form \\unnnn does not solve this problem.)
350 の表現がロケールやプラットホームに依存していることに原因がある。
351 (glibc ではワイド文字として Unicode (ISO-10646) のコードポイントを
352 使用している。他のプラットホームではそうではない。同様に
353 ISO C99 の \\unnnn 形式の汎用文字名称はこの問題を解決しない。)
355 .\"O internationalized programs, the \fIformat\fP string should consist of ASCII
356 .\"O wide characters only, or should be constructed at run time in an
357 .\"O internationalized way (e.g., using
362 .\"O .BR mbstowcs (3)).
363 このため国際化されたプログラムでは \fIformat\fP 文字列を ASCII ワイド
364 文字のみにするか、実行時に国際化された方法で構成する必要がある