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 .\" 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>
18 .TH WCRTOMB 3 2011-09-28 "GNU" "Linux Programmer's Manual"
21 .\"O wcrtomb \- convert a wide character to a multibyte sequence
22 wcrtomb \- ¥ï¥¤¥Éʸ»ú 1 ¤Ä¤ò¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÊÑ´¹¤¹¤ë
28 .BI "size_t wcrtomb(char *" s ", wchar_t " wc ", mbstate_t *" ps );
32 .\"O The main case for this function is when \fIs\fP is
33 .\"O not NULL and \fIwc\fP is not a null wide character (L\(aq\\0\(aq).
34 ¤³¤Î´Ø¿ô¤¬¼ç¤Ë»È¤ï¤ì¤ë¤Î¤Ï¡¢\fIs\fP ¤¬ NULL ¤Ç¤Ê¤¯¡¢
35 \fIwc\fP ¤¬ NULL ¥ï¥¤¥Éʸ»ú (L\(aq\\0\(aq) ¤Ç¤Ê¤¤¾ì¹ç¤Ç¤¢¤ë¡£
36 .\"O In this case, the
39 .\"O converts the wide character \fIwc\fP
40 .\"O to its multibyte representation and stores it
41 .\"O at the beginning of the character
42 .\"O array pointed to by \fIs\fP.
43 .\"O It updates the shift state \fI*ps\fP, and
44 .\"O returns the length of said multibyte representation,
45 .\"O that is, the number of bytes
46 .\"O written at \fIs\fP.
49 ´Ø¿ô¤Ï¥ï¥¤¥Éʸ»ú \fIwc\fP ¤ò¥Þ¥ë¥Á¥Ð¥¤¥Èɽ
50 ¸½¤ËÊÑ´¹¤·¡¢\fIs\fP ¤¬»Ø¤¹ char ·¿¤ÎÇÛÎó¤Ë¤³¤ì¤ò³ÊǼ¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï
51 ¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤·¡¢½ÐÎϤµ¤ì¤¿¥Þ¥ë¥Á¥Ð¥¤¥Èɽ¸½¤ÎŤµ¡¢¤¹¤Ê
52 ¤ï¤Á \fIs\fP ¤Ë½ñ¤¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
54 .\"O A different case is when \fIs\fP is not NULL,
55 .\"O but \fIwc\fP is a null wide character (L\(aq\\0\(aq).
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 ¤Ç¤Ê¤¤¤¬
69 \fIwc\fP ¤¬ NULL ¥ï¥¤¥Éʸ»ú (L\(aq\\0\(aq) ¤Î¤³¤È¤¬¤¢¤ë¡£
72 ´Ø¿ô¤Ï¡¢\fI*ps\fP ¤ò½é´ü¾õÂÖ¤ËÌ᤹¤Î¤Ëɬ
73 Íפʥ·¥Õ¥È¥·¡¼¥±¥ó¥¹¤ò \fIs\fP ¤¬»Ø¤¹ char ·¿ÇÛÎó¤Ë³ÊǼ¤·¡¢¤½¤Î¸å¤Ë \(aq\\0\(aq
74 ¤ò³ÊǼ¤¹¤ë¡£¤³¤Î´Ø¿ô¤Ï¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤·(¤Ä¤Þ¤ê½é´ü¾õÂÖ¤ËÌá
75 ¤·)¡¢¥·¥Õ¥È¥·¡¼¥±¥ó¥¹¤ÎŤµ¤Ë 1 ¤ò²Ã¤¨¤¿ÃͤòÊÖ¤¹¡£¤³¤ÎÃÍ¤Ï \fIs\fP ¤Ë
76 ½ñ¤¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
78 .\"O A third case is when \fIs\fP is NULL.
79 .\"O In this case \fIwc\fP is ignored,
80 .\"O and the function effectively returns
82 .\"O wcrtomb(buf, L\(aq\\0\(aq, ps)
86 .\"O is an internal anonymous buffer.
87 »°ÈÖÌܤΥ±¡¼¥¹¤Ï¡¢\fIs\fP ¤¬ NULL ¤Î»þ¤Ç¤¢¤ë¡£
88 ¤³¤Î¾ì¹ç¤Ë¤Ï \fIwc\fP ¤Ï̵»ë¤µ¤ì¡¢´Ø¿ô¤Î¼ÂºÝ¤ÎÆ°¤¤È¤·¤Æ¤Ï
90 wcrtomb(buf, L\(aq\\0\(aq, ps)
94 ¤ÏÆâÉôŪ¤Ê̵̾¥Ð¥Ã¥Õ¥¡¤Ç¤¢¤ë¡£
97 .\"O In all of the above cases, if \fIps\fP is a NULL pointer, a static anonymous
98 .\"O state only known to the
100 .\"O function is used instead.
101 °Ê¾å¤Î¤¤¤º¤ì¤Î¾ì¹ç¤â¡¢\fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ê¤é¤Ð¥·¥Õ¥È¾õÂÖ¤ÏÍѤ¤
104 ´Ø¿ô¤À¤±¤¬ÃΤäƤ¤¤ëÀÅŪ¤Êƿ̾¤Î¾õÂÖ¤¬»È¤ï¤ì¤ë¡£
105 .\"O .SH "RETURN VALUE"
109 .\"O function returns the number of
110 .\"O bytes that have been or would
111 .\"O have been written to the byte array at \fIs\fP.
112 .\"O If \fIwc\fP can not be
113 .\"O represented as a multibyte sequence (according to the current locale),
114 .\"O .I (size_t)\ \-1
115 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
117 ´Ø¿ô¤Ï¡¢\fIs\fP ¤¬»Ø¤¹¥Ð¥¤¥ÈÎó¤Ë½ñ¤¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¡¢¤¢
118 ¤ë¤¤¤Ï½ñ¤¹þ¤Þ¤ì¤¿¤Ç¤¢¤í¤¦¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£\fIwc\fP ¤ò(¸½ºß¤Î¥í¥±¡¼¥ë¤Ë
119 ½¾¤Ã¤Æ)¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Çɽ¸½¤Ç¤¤Ê¤±¤ì¤Ð¡¢
121 ¤¬ÊÖ¤µ¤ì¡¢ \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
122 .\"O .SH "CONFORMING TO"
134 ¤ÎÆ°ºî¤Ï¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Î
138 .\"O Passing NULL as \fIps\fP is not multithread safe.
139 \fIps\fP ¤Ë NULL ¤òÅϤ·¤¿ºÝ¤ÎÆ°ºî¤Ï¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤Ê¤¤¡£