OSDN Git Service

a3523108f96d5ced1d65d31ee0392aef2d646a3d
[linuxjm/LDP_man-pages.git] / draft / man3 / wcrtomb.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 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
15 .\" Translated Mon Oct 25 22:55:40 JST 1999
16 .\"           by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
17 .\"
18 .TH WCRTOMB 3 1999-07-25 "GNU" "Linux Programmer's Manual"
19 .\"O .SH NAME
20 .SH Ì¾Á°
21 .\"O wcrtomb \- convert a wide character to a multibyte sequence
22 wcrtomb \- ¥ï¥¤¥Éʸ»ú 1 ¤Ä¤ò¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÊÑ´¹¤¹¤ë
23 .\"O .SH SYNOPSIS
24 .SH ½ñ¼°
25 .nf
26 .B #include <wchar.h>
27 .sp
28 .BI "size_t wcrtomb(char *" s ", wchar_t " wc ", mbstate_t *" ps );
29 .fi
30 .\"O .SH DESCRIPTION
31 .SH ÀâÌÀ
32 .\"O The main case for this function is when \fIs\fP is
33 .\"O not NULL and \fIwc\fP is not
34 .\"O L\(aq\\0\(aq.
35 ¤³¤Î´Ø¿ô¤¬¼ç¤Ë»È¤ï¤ì¤ë¤Î¤Ï¡¢\fIs\fP ¤¬ NULL ¤Ç¤Ê¤¯¡¢\fIwc\fP ¤¬ L\(aq\\0\(aq
36 ¤Ç¤Ê¤¤¾ì¹ç¤Ç¤¢¤ë¡£
37 .\"O In this case, the
38 .\"O .BR wcrtomb ()
39 .\"O function
40 .\"O converts the wide character \fIwc\fP
41 .\"O to its multibyte representation and stores it
42 .\"O at the beginning of the character
43 .\"O array pointed to by \fIs\fP.
44 .\"O It updates the shift state \fI*ps\fP, and
45 .\"O returns the length of said multibyte representation,
46 .\"O that is, the number of bytes
47 .\"O written at \fIs\fP.
48 ¤³¤Î¾ì¹ç¤Ë¤Ï¡¢
49 .BR wcrtomb ()
50 ´Ø¿ô¤Ï¥ï¥¤¥Éʸ»ú \fIwc\fP ¤ò¥Þ¥ë¥Á¥Ð¥¤¥Èɽ
51 ¸½¤ËÊÑ´¹¤·¡¢\fIs\fP ¤¬»Ø¤¹ char ·¿¤ÎÇÛÎó¤Ë¤³¤ì¤ò³ÊǼ¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï
52 ¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤·¡¢½ÐÎϤµ¤ì¤¿¥Þ¥ë¥Á¥Ð¥¤¥Èɽ¸½¤ÎŤµ¡¢¤¹¤Ê
53 ¤ï¤Á \fIs\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
54 .PP
55 .\"O A different case is when \fIs\fP is not NULL but \fIwc\fP is L\(aq\\0\(aq.
56 .\"O In this
57 .\"O case the
58 .\"O .BR wcrtomb ()
59 .\"O function stores at
60 .\"O the character array pointed to by
61 .\"O \fIs\fP the shift sequence needed to
62 .\"O bring \fI*ps\fP back to the initial state,
63 .\"O followed by a \(aq\\0\(aq byte.
64 .\"O It updates the shift state \fI*ps\fP (i.e., brings
65 .\"O it into the initial state),
66 .\"O and returns the length of the shift sequence plus
67 .\"O one, that is, the number of bytes written at \fIs\fP.
68 Ê̤Υ±¡¼¥¹¤È¤·¤Æ¤Ï¡¢\fIs\fP ¤Ï NULL ¤Ç¤Ê¤¤¤¬ \fIwc\fP ¤¬ L\(aq\\0\(aq ¤Î¤³¤È¤¬
69 ¤¢¤ë¡£¤³¤Î¾ì¹ç¤Î
70 .BR wcrtomb ()
71 ´Ø¿ô¤Ï¡¢\fI*ps\fP ¤ò½é´ü¾õÂÖ¤ËÌ᤹¤Î¤Ëɬ
72 Íפʥ·¥Õ¥È¥·¡¼¥±¥ó¥¹¤ò \fIs\fP ¤¬»Ø¤¹ char ·¿ÇÛÎó¤Ë³ÊǼ¤·¡¢¤½¤Î¸å¤Ë \(aq\\0\(aq
73 ¤ò³ÊǼ¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤·(¤Ä¤Þ¤ê½é´ü¾õÂÖ¤ËÌá
74 ¤·)¡¢¥·¥Õ¥È¥·¡¼¥±¥ó¥¹¤ÎŤµ¤Ë 1 ¤ò²Ã¤¨¤¿ÃͤòÊÖ¤¹¡£¤³¤ÎÃͤϠ\fIs\fP ¤Ë
75 ½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
76 .PP
77 .\"O A third case is when \fIs\fP is NULL.
78 .\"O In this case \fIwc\fP is ignored,
79 .\"O and the function effectively returns wcrtomb(buf,L\(aq\\0\(aq,\fIps\fP) where
80 .\"O buf is an internal anonymous buffer.
81 »°ÈÖÌܤΥ±¡¼¥¹¤Ï¡¢\fIs\fP ¤¬ NULL ¤Î»þ¤Ç¤¢¤ë¡£¤³¤Î¾ì¹ç¤Ë¤Ï \fIwc\fP ¤Ï
82 ̵»ë¤µ¤ì¡¢´Ø¿ô¤Î¼ÂºÝ¤Î¸ú²Ì¤È¤·¤Æ¤Ï wcrtomb(buf,L\(aq\\0\(aq,\fIps\fP) ¤ÈƱ¤¸
83 Ãͤ¬ÊÖ¤µ¤ì¤ë¡£¤³¤³¤Ç¡¢buf ¤ÏÆâÉôŪ¤Êƿ̾¤Î¥Ð¥Ã¥Õ¥¡¤Ç¤¢¤ë¡£
84
85 .PP
86 .\"O In all of the above cases, if \fIps\fP is a NULL pointer, a static anonymous
87 .\"O state only known to the
88 .\"O .BR wcrtomb ()
89 .\"O function is used instead.
90 °Ê¾å¤Î¤¤¤º¤ì¤Î¾ì¹ç¤â¡¢\fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ê¤é¤Ð¥·¥Õ¥È¾õÂÖ¤ÏÍѤ¤
91 ¤é¤ì¤º¡¢
92 .BR wcrtomb ()
93 ´Ø¿ô¤À¤±¤¬ÃΤäƤ¤¤ëÀÅŪ¤Êƿ̾¤Î¾õÂÖ¤¬»È¤ï¤ì¤ë¡£
94 .\"O .SH "RETURN VALUE"
95 .SH ÊÖ¤êÃÍ
96 .\"O The
97 .\"O .BR wcrtomb ()
98 .\"O function returns the number of
99 .\"O bytes that have been or would
100 .\"O have been written to the byte array at \fIs\fP.
101 .\"O If \fIwc\fP can not be
102 .\"O represented as a multibyte sequence (according to the current locale),
103 .\"O .I (size_t)\ \-1
104 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
105 .BR wcrtomb ()
106 ´Ø¿ô¤Ï¡¢\fIs\fP ¤¬»Ø¤¹¥Ð¥¤¥ÈÎó¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¡¢¤¢
107 ¤ë¤¤¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¤Ç¤¢¤í¤¦¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£\fIwc\fP ¤ò(¸½ºß¤Î¥í¥±¡¼¥ë¤Ë
108 ½¾¤Ã¤Æ)¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Çɽ¸½¤Ç¤­¤Ê¤±¤ì¤Ð¡¢
109 .I (size_t)\ \-1
110 ¤¬ÊÖ¤µ¤ì¡¢ \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
111 .\"O .SH "CONFORMING TO"
112 .SH ½àµò
113 C99.
114 .\"O .SH NOTES
115 .SH Ãí°Õ
116 .\"O The behavior of
117 .\"O .BR wcrtomb ()
118 .\"O depends on the
119 .\"O .B LC_CTYPE
120 .\"O category of the
121 .\"O current locale.
122 .BR wcrtomb ()
123 ¤ÎÆ°ºî¤Ï¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Î
124 .B LC_CTYPE
125 ¥«¥Æ¥´¥ê¤Ë°Í¸¤¹¤ë¡£
126 .PP
127 .\"O Passing NULL as \fIps\fP is not multithread safe.
128 \fIps\fP ¤Ë NULL ¤òÅϤ·¤¿ºÝ¤ÎÆ°ºî¤Ï¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤Ê¤¤¡£
129 .\"O .SH "SEE ALSO"
130 .SH ´ØÏ¢¹àÌÜ
131 .BR wcsrtombs (3)