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:56:04 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
19 .TH MBSTOWCS 3 1999-07-25 "GNU" "Linux Programmer's Manual"
22 .\"O mbstowcs \- convert a multibyte string to a wide-character string
23 mbstowcs \- ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹¤¹¤ë
27 .B #include <stdlib.h>
29 .BI "size_t mbstowcs(wchar_t *" dest ", const char *" src ", size_t " n );
33 .\"O If \fIdest\fP is not a NULL pointer, the
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 ¥Ý¥¤¥ó¥¿¡¼¤Ç¤Ê¤±¤ì¤Ð
44 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó \fI*src\fP ¤ò \fIdest\fP ¤«¤é»Ï¤Þ¤ë¥ï¥¤¥Éʸ»úÎó¤Ë
45 ÊÑ´¹¤¹¤ë¡£\fIdest\fP ¤Ë¤ÏºÇÂç¤Ç \fIn\fP ʸ»ú¤Î¥ï¥¤¥Éʸ»ú¤¬
46 ½ñ¤¹þ¤Þ¤ì¤ë¡£ÊÑ´¹¤Ï½é´ü¾õÂ֤dz«»Ï¤µ¤ì¡¢
47 °Ê²¼¤Î»°¤Ä¤Î¤¤¤º¤ì¤«¤Î¾ò·ï¤ÇÄä»ß¤¹¤ë:
49 .\"O An invalid multibyte sequence has been encountered.
53 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¡£¤³¤Î¾ì¹ç¤Ë¤Ï
57 .\"O \fIn\fP non-L\(aq\\0\(aq wide characters have been stored at \fIdest\fP.
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 ¾ì½ê¤Î¥·¥Õ¥È¾õÂ֤ϼº¤ï¤ì¤ë¡£
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 ¤Ë½ñ¤¹þ¤Þ¤ì¤¿Ê¸»ú¿ô¤òÊÖ¤¹¡£
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 ¤È¤¬¤Ç¤¤ë¶õ´Ö¤¬¤¢¤ë¤³¤È¤òÊݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
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 ¹Ô¤ï¤ì¤ë¤¬¡¢ÊÑ´¹¤µ¤ì¤¿¥ï¥¤¥Éʸ»ú¤Ï¥á¥â¥ê¤Ë½ñ¤¹þ¤Þ¤ì¤º¡¢ÊÑ´¹Àè¤Î¾å¸Â
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"
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
102 ´Ø¿ô¤Ï¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹´°Î»¤·¤¿¥ï¥¤¥Éʸ»ú¤Î¿ô¤òÊÖ¤¹¡£
103 ½ªÃ¼¤Î¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ï´Þ¤Þ¤Ê¤¤¡£ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ë¤Ï
106 .\"O .SH "CONFORMING TO"
118 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
120 ¥«¥Æ¥´¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£
123 .\"O .BR mbsrtowcs (3)
124 .\"O provides a better interface to the same
127 ´Ø¿ô¤ÏƱ¤¸µ¡Ç½¤Î¤è¤êÎɤ¤¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¡£