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

📄 wcstoul.html

📁 posix标准英文,html格式
💻 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-2004 IEEE and The Open Group, All Rights Reserved --><title>wcstoul</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="wcstoul"></a> <a name="tag_03_849"></a><!-- wcstoul --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_849_01"></a>NAME</h4><blockquote>wcstoul, wcstoull - convert a wide-character string to an unsigned long</blockquote><h4><a name="tag_03_849_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include &lt;<a href="../basedefs/wchar.h.html">wchar.h</a>&gt;<br><br> unsigned long wcstoul(const wchar_t *restrict</tt> <i>nptr</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wchar_t **restrict</tt> <i>endptr</i><tt>, int</tt> <i>base</i><tt>);<br> unsigned long long wcstoull(const wchar_t *restrict</tt> <i>nptr</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wchar_t **restrict</tt> <i>endptr</i><tt>, int</tt> <i>base</i><tt>);<br></tt></code></p></blockquote><h4><a name="tag_03_849_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>wcstoul</i>() and <i>wcstoull</i>() functions shall convert the initial portion of the wide-character string pointed toby <i>nptr</i> to <b>unsigned long</b> and <b>unsigned long long</b> representation, respectively. First, they shall decompose theinput wide-character string into three parts:</p><ol><li><p>An initial, possibly empty, sequence of white-space wide-character codes (as specified by <a href="../functions/iswspace.html"><i>iswspace</i>()</a>)</p></li><li><p>A subject sequence interpreted as an integer represented in some radix determined by the value of <i>base</i></p></li><li><p>A final wide-character string of one or more unrecognized wide-character codes, including the terminating null wide-charactercode of the input wide-character string</p></li></ol><p>Then they shall attempt to convert the subject sequence to an unsigned integer, and return the result.</p><p>If <i>base</i> is 0, the expected form of the subject sequence is that of a decimal constant, octal constant, or hexadecimalconstant, any of which may be preceded by a <tt>'+'</tt> or <tt>'-'</tt> sign. A decimal constant begins with a non-zero digit, andconsists of a sequence of decimal digits. An octal constant consists of the prefix <tt>'0'</tt> optionally followed by a sequenceof the digits <tt>'0'</tt> to <tt>'7'</tt> only. A hexadecimal constant consists of the prefix 0x or 0X followed by a sequence ofthe decimal digits and letters <tt>'a'</tt> (or <tt>'A'</tt> ) to <tt>'f'</tt> (or <tt>'F'</tt> ) with values 10 to 15respectively.</p><p>If the value of <i>base</i> is between 2 and 36, the expected form of the subject sequence is a sequence of letters and digitsrepresenting an integer with the radix specified by <i>base</i>, optionally preceded by a <tt>'+'</tt> or <tt>'-'</tt> sign, butnot including an integer suffix. The letters from <tt>'a'</tt> (or <tt>'A'</tt> ) to <tt>'z'</tt> (or <tt>'Z'</tt> ) inclusive areascribed the values 10 to 35; only letters whose ascribed values are less than that of <i>base</i> shall be permitted. If the valueof <i>base</i> is 16, the wide-character codes 0x or 0X may optionally precede the sequence of letters and digits, following thesign if present.</p><p>The subject sequence is defined as the longest initial subsequence of the input wide-character string, starting with the firstwide-character code that is not white space and is of the expected form. The subject sequence contains no wide-character codes ifthe input wide-character string is empty or consists entirely of white-space wide-character codes, or if the first wide-charactercode that is not white space is other than a sign or a permissible letter or digit.</p><p>If the subject sequence has the expected form and <i>base</i> is 0, the sequence of wide-character codes starting with the firstdigit shall be interpreted as an integer constant. If the subject sequence has the expected form and the value of <i>base</i> isbetween 2 and 36, it shall be used as the base for conversion, ascribing to each letter its value as given above. If the subjectsequence begins with a minus sign, the value resulting from the conversion shall be negated. A pointer to the final wide-characterstring shall be stored in the object pointed to by <i>endptr</i>, provided that <i>endptr</i> is not a null pointer.</p><p>In other than the C <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;or POSIX <img src="../images/opt-end.gif" alt="[Option End]" border="0"> locales, otherimplementation-defined subject sequences may be accepted.</p><p>If the subject sequence is empty or does not have the expected form, no conversion shall be performed; the value of <i>nptr</i>shall be stored in the object pointed to by <i>endptr</i>, provided that <i>endptr</i> is not a null pointer.</p><p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The<i>wcstoul</i>() function shall not change the setting of <i>errno</i> if successful.</p><p>Since 0, {ULONG_MAX}, and {ULLONG_MAX} are returned on error and 0 is also a valid return on success, an application wishing tocheck for error situations should set <i>errno</i> to 0, then call <i>wcstoul</i>() or <i>wcstoull</i>(), then check <i>errno</i>.<img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_849_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, the <i>wcstoul</i>() and <i>wcstoull</i>() functions shall return the converted value, if any. If noconversion could be performed, 0 shall be returned <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and <i>errno</i> may be set to indicate the error. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> If the correct value is outside the range of representable values,{ULONG_MAX} or {ULLONG_MAX} respectively shall be returned and <i>errno</i> set to [ERANGE].</p></blockquote><h4><a name="tag_03_849_05"></a>ERRORS</h4><blockquote><p>These functions shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The value of <i>base</i> is not supported. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[ERANGE]</dt><dd>The value to be returned is not representable.</dd></dl><p>These functions may fail if:</p><dl compact><dt>[EINVAL]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Noconversion could be performed. <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_849_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_849_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_849_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_849_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_849_10"></a>SEE ALSO</h4><blockquote><p><a href="iswalpha.html"><i>iswalpha</i>()</a>, <a href="scanf.html"><i>scanf</i>()</a>, <a href="wcstod.html"><i>wcstod</i>()</a>, <a href="wcstol.html"><i>wcstol</i>()</a>, the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/wchar.h.html"><i>&lt;wchar.h&gt;</i></a></p></blockquote><h4><a name="tag_03_849_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4. Derived from the MSE working draft.</p></blockquote><h4><a name="tag_03_849_12"></a>Issue 5</h4><blockquote><p>The DESCRIPTION is updated to indicate that <i>errno</i> is not changed if the function is successful.</p></blockquote><h4><a name="tag_03_849_13"></a>Issue 6</h4><blockquote><p>Extensions beyond the ISO&nbsp;C standard are marked.</p><p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p><ul><li><p>The [EINVAL] error condition is added for when the value of <i>base</i> is not supported.</p><p>In the RETURN VALUE and ERRORS sections, the [EINVAL] optional error condition is added if no conversion could be performed.</p></li></ul><p>The following changes are made for alignment with the ISO/IEC&nbsp;9899:1999 standard:</p><ul><li><p>The <i>wcstoul</i>() prototype is updated.</p></li><li><p>The <i>wcstoull</i>() function is added.</p></li></ul></blockquote><div class="box"><em>End of informative text.</em></div><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 + -