📄 mbsrtowcs.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>mbsrtowcs</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_547"> </a>NAME</h4><blockquote>mbsrtowcs - convert a character string to a wide-character string(restartable)</blockquote><h4><a name = "tag_000_007_548"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="wchar.h.html">wchar.h</a>>size_t mbsrtowcs(wchar_t *<i>dst</i>, const char **<i>src</i>, size_t <i>len</i>, mbstate_t *<i>ps</i>);</code></pre></blockquote><h4><a name = "tag_000_007_549"> </a>DESCRIPTION</h4><blockquote>The<i>mbsrtowcs()</i>function converts a sequence of characters, beginning in theconversion state described by the object pointed to by<i>ps</i>,from the array indirectly pointed to by<i>src</i>into a sequence of corresponding wide-characters. If<i>dst</i>is not a null pointer, the converted characters are stored into thearray pointed to by <i>dst</i>.Conversion continues up to and including a terminating null character,which is also stored. Conversion stops early in either of thefollowing cases:<ul><p><li>When a sequence of bytes is encountered that does not form a validcharacter.<p><li>When<i>len</i>codes have been stored into the array pointed to by<i>dst</i>(and <i>dst</i>is not a null pointer).<p></ul><p>Each conversion takes place as if by a call to the<i><a href="mbrtowc.html">mbrtowc()</a></i>function.<p>If<i>dst</i>is not a null pointer, the pointer object pointed to by<i>src</i>is assigned either a null pointer (if conversion stopped due toreaching a terminating null character) or the address just past thelast character converted (if any). If conversion stoppeddue to reaching a terminating null character, and if<i>dst</i>is not a null pointer, the resulting state described is the initialconversion state.<p>If<i>ps</i>is a null pointer, the<i>mbsrtowcs()</i>function uses its own internal<b>mbstate_t</b>object, which is initialised at program startup to the initialconversion state. Otherwise, the <b>mbstate_t</b>object pointed to by<i>ps</i>is used to completely describe the current conversion state of theassociated character sequence.The implementation will behave as if no function defined in thisspecification calls<i>mbsrtowcs()</i>.<p>The behaviour of this function is affected by the LC_CTYPE category ofthe current locale. </blockquote><h4><a name = "tag_000_007_550"> </a>RETURN VALUE</h4><blockquote>If the input conversion encounters a sequence of bytes that do notform a valid character, an encoding error occurs. In thiscase, the<i>mbsrtowcs()</i>function stores the value of the macro EILSEQ in<i>errno</i>and returns<b>(size_t)-1)</b>;the conversion state is undefined. Otherwise, it returns the numberof characters successfully converted, not including theterminating null (if any).</blockquote><h4><a name = "tag_000_007_551"> </a>ERRORS</h4><blockquote>The<i>mbsrtowcs()</i>function may fail if:<dl compact><dt>[EINVAL]<dd><i>ps</i>points to an object that contains an invalid conversion state.<dt>[EILSEQ]<dd>Invalid character sequence is detected.</dl></blockquote><h4><a name = "tag_000_007_552"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_553"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_554"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_555"> </a>SEE ALSO</h4><blockquote><i><a href="mbsinit.html">mbsinit()</a></i>,<i><a href="mbrtowc.html">mbrtowc()</a></i>,<i><a href="wchar.h.html"><wchar.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the ISO/IEC 9899:1990/Amendment 1:1995 (E).</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 + -