OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / mbstowcs.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 .\"   ISO/IEC 9899:1999
13 .\"
14 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
15 .\"         all rights reserved.
16 .\" Translated Tue Jan 11 00:56:04 JST 2000
17 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
18 .\"
19 .TH MBSTOWCS 3 1999-07-25 "GNU" "Linux Programmer's Manual"
20 .\"O .SH NAME
21 .SH Ì¾Á°
22 .\"O mbstowcs \- convert a multibyte string to a wide-character string
23 mbstowcs \- ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹¤¹¤ë
24 .\"O .SH SYNOPSIS
25 .SH ½ñ¼°
26 .nf
27 .B #include <stdlib.h>
28 .sp
29 .BI "size_t mbstowcs(wchar_t *" dest ", const char *" src ", size_t " n );
30 .fi
31 .\"O .SH DESCRIPTION
32 .SH ÀâÌÀ
33 .\"O If \fIdest\fP is not a NULL pointer, the
34 .\"O .BR mbstowcs ()
35 .\"O function converts the
36 .\"O multibyte string \fIsrc\fP to a wide-character string starting at \fIdest\fP.
37 .\"O At most \fIn\fP wide characters are written to \fIdest\fP.
38 .\"O The conversion starts
39 .\"O in the initial state.
40 .\"O The conversion can stop for three reasons:
41 \fIdest\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ç¤Ê¤±¤ì¤Ð
42 .BR mbstowcs ()
43 ´Ø¿ô¤Ï
44 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó \fI*src\fP ¤ò \fIdest\fP ¤«¤é»Ï¤Þ¤ë¥ï¥¤¥Éʸ»úÎó¤Ë
45 ÊÑ´¹¤¹¤ë¡£\fIdest\fP ¤Ë¤ÏºÇÂç¤Ç \fIn\fP Ê¸»ú¤Î¥ï¥¤¥Éʸ»ú¤¬
46 ½ñ¤­¹þ¤Þ¤ì¤ë¡£ÊÑ´¹¤Ï½é´ü¾õÂ֤dz«»Ï¤µ¤ì¡¢
47 °Ê²¼¤Î»°¤Ä¤Î¤¤¤º¤ì¤«¤Î¾ò·ï¤ÇÄä»ß¤¹¤ë:
48 .IP 1. 3
49 .\"O An invalid multibyte sequence has been encountered.
50 .\"O In this case
51 .\"O .I (size_t)\ \-1
52 .\"O is returned.
53 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¡£¤³¤Î¾ì¹ç¤Ë¤Ï
54 .I (size_t)\ \-1
55 ¤òÊÖ¤¹¡£
56 .IP 2.
57 .\"O \fIn\fP non-L\(aq\\0\(aq wide characters have been stored at \fIdest\fP.
58 .\"O In this
59 .\"O case the number of wide characters written to \fIdest\fP is returned, but the
60 .\"O shift state at this point is lost.
61 \fIn\fP Ê¸»ú¤Î L\(aq\\0\(aq °Ê³°¤Î¥ï¥¤¥Éʸ»ú¤ò \fIdest\fP ¤Ë³ÊǼ¤·¤¿¾ì¹ç¡£
62 ¤³¤Î¾ì¹ç¤Ï \fI*src\fP ¤¬¼¡¤ËÊÑ´¹¤µ¤ì¤ë¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò»Ø¤¹¤è¤¦¤Ë¤·¤Æ¡¢
63 \fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥ï¥¤¥Éʸ»ú¤Î¿ô¤òÊÖ¤¹¡£¤·¤«¤·¤³¤Î»Ø¤·¤Æ¤¤¤ë
64 ¾ì½ê¤Î¥·¥Õ¥È¾õÂ֤ϼº¤ï¤ì¤ë¡£
65 .IP 3.
66 .\"O The multibyte string has been completely converted, including the
67 .\"O terminating \(aq\\0\(aq.
68 .\"O In this case the number of wide characters written to
69 .\"O \fIdest\fP, excluding the terminating L\(aq\\0\(aq character, is returned.
70 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎ󤬽ªÃ¼¤Î \(aq\\0\(aq ¤Þ¤Ç´Þ¤á¤Æ´°Á´¤ËÊÑ´¹¤µ¤ì¤¿¾ì¹ç¡£
71 ¤³¤Î¾ì¹ç¤Ï½ªÃ¼¤Î L\(aq\\0\(aq Ê¸»ú¤ò½ü¤¤¤Æ
72 \fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿Ê¸»ú¿ô¤òÊÖ¤¹¡£
73 .PP
74 .\"O The programmer must ensure that there is room for at least \fIn\fP wide
75 .\"O characters at \fIdest\fP.
76 ¥×¥í¥°¥é¥Þ¡¼¤Ï \fIdest\fP ¤ËºÇÄã¤Ç¤â \fIn\fP ¥ï¥¤¥Éʸ»ú¤ò½ñ¤­¹þ¤à¤³
77 ¤È¤¬¤Ç¤­¤ë¶õ´Ö¤¬¤¢¤ë¤³¤È¤òÊݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
78 .PP
79 .\"O If \fIdest\fP is NULL, \fIn\fP is ignored, and the conversion proceeds as
80 .\"O above, except that the converted wide characters are not written out to memory,
81 .\"O and that no length limit exists.
82 \fIdest\fP ¤¬ NULL ¤Î¾ì¹ç¡¢\fIn\fP ¤Ï̵»ë¤µ¤ì¡¢¾åµ­¤ÈƱÍͤÎÊÑ´¹¤¬
83 ¹Ô¤ï¤ì¤ë¤¬¡¢ÊÑ´¹¤µ¤ì¤¿¥ï¥¤¥Éʸ»ú¤Ï¥á¥â¥ê¤Ë½ñ¤­¹þ¤Þ¤ì¤º¡¢ÊÑ´¹Àè¤Î¾å¸Â
84 ¤¬Â¸ºß¤·¤Ê¤¤¡£
85 .PP
86 .\"O In order to avoid the case 2 above, the programmer should make sure \fIn\fP is
87 .\"O greater or equal to \fImbstowcs(NULL,src,0)+1\fP.
88 ¾åµ­¤Î 2. ¤Î¾ì¹ç¤òÈò¤±¤ë¤¿¤á¤Ë¥×¥í¥°¥é¥Þ¡¼¤Ï \fIn\fP ¤¬
89 \fImbstowcs(NULL,src,0)+1\fP °Ê¾å¤Ç¤¢¤ë¤³¤È¤òÊݾڤ¹¤Ù¤­¤Ç¤¢¤ë¡£
90 .\"O .SH "RETURN VALUE"
91 .SH ÊÖ¤êÃÍ
92 .\"O The
93 .\"O .BR mbstowcs ()
94 .\"O function returns the number of wide characters that make
95 .\"O up the converted part of the wide-character string, not including the
96 .\"O terminating null wide character.
97 .\"O If an invalid multibyte sequence was
98 .\"O encountered,
99 .\"O .I (size_t)\ \-1
100 .\"O is returned.
101 .BR mbstowcs ()
102 ´Ø¿ô¤Ï¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹´°Î»¤·¤¿¥ï¥¤¥Éʸ»ú¤Î¿ô¤òÊÖ¤¹¡£
103 ½ªÃ¼¤Î¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ï´Þ¤Þ¤Ê¤¤¡£ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ë¤Ï
104 .I (size_t)\ \-1
105 ¤òÊÖ¤¹¡£
106 .\"O .SH "CONFORMING TO"
107 .SH ½àµò
108 C99.
109 .\"O .SH NOTES
110 .SH Ãí°Õ
111 .\"O The behavior of
112 .\"O .BR mbstowcs ()
113 .\"O depends on the
114 .\"O .B LC_CTYPE
115 .\"O category of the
116 .\"O current locale.
117 .BR mbstowcs ()
118 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
119 .B LC_CTYPE
120 ¥«¥Æ¥´¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£
121 .PP
122 .\"O The function
123 .\"O .BR mbsrtowcs (3)
124 .\"O provides a better interface to the same
125 .\"O functionality.
126 .BR mbsrtowcs (3)
127 ´Ø¿ô¤ÏƱ¤¸µ¡Ç½¤Î¤è¤êÎɤ¤¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¡£
128 .\"O .SH "SEE ALSO"
129 .SH ´ØÏ¢¹àÌÜ
130 .BR mbsrtowcs (3)