OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / wcsnrtombs.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
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.
7 .\"
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
12 .\"
13 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
14 .\" Translated Fri Oct 22 01:12:12 JST 1999
15 .\"           by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
16 .\"
17 .TH WCSNRTOMBS 3  2010-09-15 "GNU" "Linux Programmer's Manual"
18 .\"O .SH NAME
19 .SH Ì¾Á°
20 .\"O wcsnrtombs \- convert a wide-character string to a multibyte string
21 wcsnrtombs \- ¥ï¥¤¥Éʸ»úʸ»úÎó¤ò¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ËÊÑ´¹¤¹¤ë
22 .\"O .SH SYNOPSIS
23 .SH ½ñ¼°
24 .nf
25 .B #include <wchar.h>
26 .sp
27 .BI "size_t wcsnrtombs(char *" dest ", const wchar_t **" src ", size_t " nwc ,
28 .BI "                  size_t " len ", mbstate_t *" ps );
29 .fi
30 .sp
31 .in -4n
32 .\"O Feature Test Macro Requirements for glibc (see
33 .\"O .BR feature_test_macros (7)):
34 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
35 .RB ( feature_test_macros (7)
36 »²¾È):
37 .in
38 .sp
39 .BR wcsnrtombs ():
40 .PD 0
41 .ad l
42 .RS 4
43 .TP 4
44 .\"O Since glibc 2.10:
45 glibc 2.10 °Ê¹ß:
46 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
47 .TP
48 .\"O Before glibc 2.10:
49 glibc 2.10 ¤è¤êÁ°:
50 _GNU_SOURCE
51 .RE
52 .ad
53 .PD
54 .\"O .SH DESCRIPTION
55 .SH ÀâÌÀ
56 .\"O The
57 .\"O .BR wcsnrtombs ()
58 .\"O function is like the
59 .\"O .BR wcsrtombs (3)
60 .\"O function,
61 .\"O except that the number of wide characters to be converted,
62 .\"O starting at \fI*src\fP, is limited to \fInwc\fP.
63 .BR wcsnrtombs ()
64 ´Ø¿ô¤Ï¡¢
65 .BR wcsrtombs ()
66 ´Ø¿ô¤Ë»÷¤Æ¤¤¤ë¡£¤¿¤À¤·¡¢
67 ÊÑ´¹¤µ¤ì¤ë¥ï¥¤¥Éʸ»ú¤Î¿ô¤¬(\fI*src\fP ¤«¤é¿ô¤¨¤Æ) \fInwc\fP Ê¸»ú¤ËÀ©¸Â
68 ¤µ¤ì¤Æ¤¤¤ëÅÀ¤¬°Û¤Ê¤ë¡£
69 .PP
70 .\"O If \fIdest\fP is not a NULL pointer,
71 .\"O the
72 .\"O .BR wcsnrtombs ()
73 .\"O function converts
74 .\"O at most \fInwc\fP wide characters from
75 .\"O the wide-character string \fI*src\fP to a multibyte string starting at
76 .\"O \fIdest\fP.
77 .\"O At most \fIlen\fP bytes are written to \fIdest\fP.
78 .\"O The shift state
79 .\"O \fI*ps\fP is updated.
80 .\"O The conversion is effectively performed by repeatedly
81 .\"O calling
82 .\"O .IR "wcrtomb(dest, *src, ps)" ,
83 .\"O as long as this call succeeds,
84 .\"O and then incrementing \fIdest\fP by the
85 .\"O number of bytes written and \fI*src\fP
86 .\"O by one.
87 .\"O The conversion can stop for three reasons:
88 \fIdest\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¡¢
89 .BR wcsnrtombs ()
90 ´Ø¿ô¤Ï
91 ¥ï¥¤¥Éʸ»úʸ»úÎó¤ÎºÇÂç \fInwc\fP ¸Ä¤Þ¤Ç¤Î¥ï¥¤¥Éʸ»ú¤ò \fIdest\fP ¤«¤é
92 »Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ËÊÑ´¹¤¹¤ë¡£\fIdest\fP ¤Ë¤ÏºÇÂç \fIlen\fP ¥Ð¥¤
93 ¥È¤Þ¤Ç½ñ¤­¹þ¤Þ¤ì¤ë¡£¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤Ï¹¹¿·¤µ¤ì¤ë¡£¼ÂºÝ¤Î¸ú²Ì¤È¤·
94 ¤Æ¤Ï¡¢¤³¤ÎÊÑ´¹¤Ï°Ê²¼¤ÎÆ°ºî¤ÈƱ¤¸¤Ë¤Ê¤ë:
95 .IR "wcrtomb(dest, *src, ps)"
96 ¤ò¸Æ¤Ó¡¢À®¸ù¤¬Ê֤俤é
97 \fIdest\fP ¤ò½ñ¤­¹þ¤ó¤À¥Ð¥¤¥È¿ô¤À¤±Áý¤ä¤·¡¢\fI*src\fP ¤ò 1 Áý¤ä¤¹¡£
98 ¤½¤·¤Æ¡¢wcrtomb ¤¬À®¸ù¤òÊÖ¤¹¸Â¤ê¤³¤ì¤ò·«¤êÊÖ¤¹¡£
99 ÊÑ´¹¤¬»ß¤Þ¤ëÍýͳ¤Ï 3 ¤Ä¹Í¤¨¤é¤ì¤ë:
100 .PP
101 .\"O 1. A wide character has been encountered that can not be represented as a
102 .\"O multibyte sequence (according to the current locale).
103 .\"O In this case \fI*src\fP
104 .\"O is left pointing to the invalid wide character,
105 .\"O .I (size_t)\ \-1
106 .\"O is returned,
107 .\"O and \fIerrno\fP is set to \fBEILSEQ\fP.
108 1. (¸½ºß¤Î¥í¥±¡¼¥ë¤Ë´ð¤Å¤¤¤Æ)¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Çɽ¸½¤Ç¤­¤Ê¤¤¥ï¥¤¥Éʸ»ú¤Ë
109 ½Ð²ñ¤Ã¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ï¡¢\fI*src\fP ¤ÏÉÔÀµ¤Ê¥ï¥¤¥Éʸ»ú¤ò»Ø¤·¤¿¾õÂ֤ˤʤꡢ
110 .I (size_t)\ \-1
111 ¤¬ÊÖ¤µ¤ì¡¢\fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
112 .PP
113 .\"O 2. \fInwc\fP wide characters have been
114 .\"O converted without encountering a L\(aq\\0\(aq,
115 .\"O or the length limit forces a stop.
116 .\"O In this case \fI*src\fP is left pointing
117 .\"O to the next wide character to be converted, and the number of bytes written
118 .\"O to \fIdest\fP is returned.
119 2. L\(aq\\0\(aq ¤Ë½Ð²ñ¤ï¤Ê¤¤¤Ç \fInwc\fP ¸Ä¤Î¥ï¥¤¥Éʸ»ú¤òÊÑ´¹¤·¤¿¾ì¹ç¤«¡¢Ä¹
120 ¤µ¤ÎÀ©¸Â¤Ë¤è¤Ã¤ÆÊÑ´¹¤¬»ß¤á¤é¤ì¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ë¤Ï¡¢\fI*src\fP ¤Ï¼¡¤Ë
121 ÊÑ´¹¤µ¤ì¤ë¤Ù¤­¥ï¥¤¥Éʸ»ú¤ò»Ø¤·¤¿¾õÂ֤ˤʤꡢ\fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿
122 ¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë¡£
123 .PP
124 .\"O 3. The wide-character string has been completely converted, including the
125 .\"O terminating L\(aq\\0\(aq (which has the side effect of bringing back \fI*ps\fP
126 .\"O to the initial state).
127 .\"O In this case \fI*src\fP is set to NULL, and the number
128 .\"O of bytes written to \fIdest\fP, excluding the terminating \(aq\\0\(aq byte, is
129 .\"O returned.
130 3. ¥ï¥¤¥Éʸ»úÎ󤬽ªÃ¼¤Î L\(aq\\0\(aq (¤³¤ì¤Ë¤Ï \fI*ps\fP ¤ò½é´ü¾õÂÖ¤ËÌ᤹¤È
131 ¤¤¤¦ÉûºîÍѤ¬¤¢¤ë)¤â´Þ¤á¤ÆÁ´¤ÆÊÑ´¹¤µ¤ì¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ë¤Ï \fI*src\fP
132 ¤Ë NULL ¤¬ÀßÄꤵ¤ì¡¢\fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë
133 (½ªÃ¼¤Î \(aq\\0\(aq ¤Ï¿ô¤¨¤Ê¤¤)¡£
134 .PP
135 .\"O If \fIdest\fP is NULL, \fIlen\fP is ignored,
136 .\"O and the conversion proceeds as above,
137 .\"O except that the converted bytes are not written out to memory, and that
138 .\"O no destination length limit exists.
139 \fIdest\fP ¤¬ NULL ¤Ê¤é¤Ð \fIlen\fP ¤Ï̵»ë¤µ¤ì¤ÆÁ°½Ò¤Î¤è¤¦¤ËÊÑ´¹¤¬¹Ô¤ï
140 ¤ì¤ë¤¬¡¢ÊÑ´¹¤µ¤ì¤¿¥Ð¥¤¥È¥Ç¡¼¥¿¤Ï¥á¥â¥ê¤Ë½ñ¤­½Ð¤µ¤ì¤Ê¤¤ÅÀ¤È¡¢½ÐÎÏÀè¤ÎĹ
141 ¤µ¤ÎÀ©¸Â¤¬¤Ê¤¤ÅÀ¤¬°Û¤Ê¤ë¡£
142 .PP
143 .\"O In both of the above cases,
144 .\"O if \fIps\fP is a NULL pointer, a static anonymous
145 .\"O state only known to the wcsnrtombs function is used instead.
146 ¾åµ­¤Î¤¤¤º¤ì¤Î¾ì¹ç¤â¡¢\fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ê¤é¤Ð¡¢wcsnrtombs ´Ø¿ô
147 ¤À¤±¤¬ÃΤäƤ¤¤ëÀÅŪ¤Êƿ̾¤Î¾õÂÖ¤¬¥·¥Õ¥È¾õÂÖ¤ÎÂå¤ï¤ê¤ËÍѤ¤¤é¤ì¤ë¡£
148 .PP
149 .\"O The programmer must ensure that there is room for at least \fIlen\fP bytes
150 .\"O at \fIdest\fP.
151 ¥×¥í¥°¥é¥Þ¤Ï¾¯¤Ê¤¯¤È¤â \fIlen\fP ¥Ð¥¤¥È¤ÎÎΰè¤ò \fIdest\fP ¤Ë³ÎÊݤ·¤Ê
152 ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
153 .\"O .SH "RETURN VALUE"
154 .SH ÊÖ¤êÃÍ
155 .\"O The
156 .\"O .BR wcsnrtombs ()
157 .\"O function returns
158 .\"O the number of bytes that make up the
159 .\"O converted part of multibyte sequence,
160 .\"O not including the terminating null byte.
161 .BR wcsnrtombs ()
162 ´Ø¿ô¤Ï¡¢ÊÑ´¹¤·¤ÆÆÀ¤é¤ì¤¿¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Î¥Ð¥¤¥È¿ô¤òÊÖ
163 ¤¹¡£¤³¤ì¤Ë¤Ï½ªÃ¼¤Î null ¥Ð¥¤¥È¤Ï´Þ¤Þ¤Ê¤¤¡£
164 .\"O If a wide character was encountered which
165 .\"O could not be converted,
166 .\"O .I (size_t)\ \-1
167 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
168 ÊÑ´¹¤Ç¤­¤Ê¤¤¥ï¥¤¥Éʸ»ú¤Ë½Ð²ñ¤Ã¤¿¾ì¹ç¤Ë¤Ï
169 .I (size_t)\ \-1
170 ¤¬ÊÖ¤µ¤ì¡¢ \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
171 .\"O .SH "CONFORMING TO"
172 .SH ½àµò
173 .\"O This function is a GNU extension.
174 ¤³¤Î´Ø¿ô¤Ï GNU ³ÈÄ¥¤Ç¤¢¤ë¡£
175 .\"O .SH NOTES
176 .SH Ãí°Õ
177 .\"O The behavior of
178 .\"O .BR wcsnrtombs ()
179 .\"O depends on the
180 .\"O .B LC_CTYPE
181 .\"O category of the
182 .\"O current locale.
183 .BR wcsnrtombs ()
184 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
185 .B LC_CTYPE
186 ¥«¥Æ¥´¥ê¤Ë°Í¸¤¹¤ë¡£
187 .PP
188 .\"O Passing NULL as \fIps\fP is not multithread safe.
189 \fIps\fP ¤Ë NULL ¤òÅϤ·¤¿ºÝ¤ÎÆ°ºî¤Ï¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤Ê¤¤¡£
190 .\"O .SH "SEE ALSO"
191 .SH ´ØÏ¢¹àÌÜ
192 .BR iconv (3),
193 .BR wcsrtombs (3)