⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wcstombs.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>wcstombs</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="wcstombs"></a> <a name="tag_03_848"></a><!-- wcstombs --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_848_01"></a>NAME</h4><blockquote>wcstombs - convert a wide-character string to a character string</blockquote><h4><a name="tag_03_848_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include &lt;<a href="../basedefs/stdlib.h.html">stdlib.h</a>&gt;<br><br> size_t wcstombs(char *restrict</tt> <i>s</i><tt>, const wchar_t *restrict</tt> <i>pwcs</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size_t</tt> <i>n</i><tt>);<br></tt></code></p></blockquote><h4><a name="tag_03_848_03"></a>DESCRIPTION</h4><blockquote><div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> The functionality described on this reference page is aligned with the ISO&nbsp;C standard. Any conflict between therequirements described here and the ISO&nbsp;C standard is unintentional. This volume of IEEE&nbsp;Std&nbsp;1003.1-2001 defers tothe ISO&nbsp;C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div><p>The <i>wcstombs</i>() function shall convert the sequence of wide-character codes that are in the array pointed to by<i>pwcs</i> into a sequence of characters that begins in the initial shift state and store these characters into the array pointedto by <i>s</i>, stopping if a character would exceed the limit of <i>n</i> total bytes or if a null byte is stored. Eachwide-character code shall be converted as if by a call to <a href="../functions/wctomb.html"><i>wctomb</i>()</a>, except that theshift state of <a href="../functions/wctomb.html"><i>wctomb</i>()</a> shall not be affected.</p><p>The behavior of this function shall be affected by the <i>LC_CTYPE</i> category of the current locale.</p><p>No more than <i>n</i> bytes shall be modified in the array pointed to by <i>s</i>. If copying takes place between objects thatoverlap, the behavior is undefined. <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif"alt="[Option Start]" border="0"> &nbsp;If <i>s</i> is a null pointer, <i>wcstombs</i>() shall return the length required to convertthe entire array regardless of the value of <i>n</i>, but no values are stored.</p><p>The <i>wcstombs</i>() function need not be reentrant. A function that is not required to be reentrant is not required to bethread-safe. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_848_04"></a>RETURN VALUE</h4><blockquote><p>If a wide-character code is encountered that does not correspond to a valid character (of one or more bytes each),<i>wcstombs</i>() shall return (<b>size_t</b>)-1. Otherwise, <i>wcstombs</i>() shall return the number of bytes stored in thecharacter array, not including any terminating null byte. The array shall not be null-terminated if the value returned is<i>n</i>.</p></blockquote><h4><a name="tag_03_848_05"></a>ERRORS</h4><blockquote><p>The <i>wcstombs</i>() function may fail if:</p><dl compact><dt>[EILSEQ]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Awide-character code does not correspond to a valid character. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_848_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_848_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_848_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_848_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_848_10"></a>SEE ALSO</h4><blockquote><p><a href="mblen.html"><i>mblen</i>()</a> , <a href="mbtowc.html"><i>mbtowc</i>()</a> , <a href="mbstowcs.html"><i>mbstowcs</i>()</a> , <a href="wctomb.html"><i>wctomb</i>()</a> , the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/stdlib.h.html"><i>&lt;stdlib.h&gt;</i></a></p></blockquote><h4><a name="tag_03_848_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4. Derived from the ISO&nbsp;C standard.</p></blockquote><h4><a name="tag_03_848_12"></a>Issue 6</h4><blockquote><p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p><ul><li><p>The DESCRIPTION states the effect of when <i>s</i> is a null pointer.</p></li><li><p>The [EILSEQ] error condition is added.</p></li></ul><p>The <i>wcstombs</i>() prototype is updated for alignment with the ISO/IEC&nbsp;9899:1999 standard.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -