📄 mbstowcs.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>mbstowcs</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_556"> </a>NAME</h4><blockquote>mbstowcs - convert a character string to a wide-character string</blockquote><h4><a name = "tag_000_007_557"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="stdlib.h.html">stdlib.h</a>>size_t mbstowcs(wchar_t *<i>pwcs</i>, const char *<i>s</i>, size_t <i>n</i>);</code></pre></blockquote><h4><a name = "tag_000_007_558"> </a>DESCRIPTION</h4><blockquote>The<i>mbstowcs()</i>function converts a sequence of characters that beginsin the initial shift state from the array pointed to by<i>s</i>into a sequence of corresponding wide-character codes and stores not more than<i>n</i>wide-character codes into the array pointed to by<i>pwcs</i>.No characters that follow a null byte (which is converted into awide-character code with value 0) will be examined or converted. Eachcharacter is converted as if by a call to<i><a href="mbtowc.html">mbtowc()</a></i>,except that the shift state of<i><a href="mbtowc.html">mbtowc()</a></i>is not affected.<p>No more than<i>n</i>elements will be modified in the array pointed to by<i>pwcs</i>.If copying takes place between objects that overlap, thebehaviour is undefined.<p>The behaviour of this function is affected bythe LC_CTYPE category of the current locale.If<i>pwcs</i>is a null pointer,<i>mbstowcs()</i>returns the length required to convert the entire array regardless of thevalue of<i>n</i>,but no values are stored.</blockquote><h4><a name = "tag_000_007_559"> </a>RETURN VALUE</h4><blockquote>If an invalid character is encountered,<i>mbstowcs()</i>returns (<b>size_t</b>)-1 and may set<i>errno</i>to indicate the error.Otherwise,<i>mbstowcs()</i>returns the number of the array elements modified (or required if<i>pwcs</i>is null), not including a terminating 0 code, if any. The array will not bezero-terminated if the value returned is<i>n</i>.</blockquote><h4><a name = "tag_000_007_560"> </a>ERRORS</h4><blockquote>The<i>mbstowcs()</i>function may fail if:<dl compact><dt>[EILSEQ]<dd>Invalid byte sequence is detected.</dl></blockquote><h4><a name = "tag_000_007_561"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_562"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_563"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_564"> </a>SEE ALSO</h4><blockquote><i><a href="mblen.html">mblen()</a></i>,<i><a href="mbtowc.html">mbtowc()</a></i>,<i><a href="wctomb.html">wctomb()</a></i>,<i><a href="wcstombs.html">wcstombs()</a></i>,<i><a href="stdlib.h.html"><stdlib.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -