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

📄 wcstol.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>wcstol</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_010_635">&nbsp;</a>NAME</h4><blockquote>wcstol - convert a wide-character string to a long integer</blockquote><h4><a name = "tag_000_010_636">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="wchar.h.html">wchar.h</a>&gt;long int wcstol(const wchar_t *<i>nptr</i>, wchar_t *<i>*endptr</i>, int <i>base</i>);</code></pre></blockquote><h4><a name = "tag_000_010_637">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>wcstol()</i>function converts the initial portion of the wide-character string pointed to by<i>nptr</i>to<b>long int</b>representation.First it decomposes the input wide-character stringinto three parts: an initial,possibly empty, sequence of white-space wide-character codes(as specified by<i><a href="iswspace.html">iswspace()</a></i>),a subject sequence interpreted as an integer representedin some radix determined by the value of<i>base</i>;and a final wide-character string of one or more unrecognised wide-charactercodes,including the terminating null wide-character code of the inputwide-character string.Then it attempts to convert the subject sequence to an integer,and returns the result.<p>If<i>base</i>is 0, the expected form of the subject sequence is that of adecimal constant, octal constant or hexadecimal constant,any of which may be preceded by a + or - sign.A decimal constant begins with a non-zero digit, and consistsof a sequence of decimal digits.An octal constant consists of the prefix0 optionally followed by a sequence of the digits 0 to 7 only.A hexadecimal constant consists of the prefix0x or 0X followed by a sequence of the decimal digits and lettersa (or A) to f (or F) with values 10 to 15 respectively.<p>If the value of<i>base</i>is between 2 and 36, the expected form of the subject sequence isa sequence of letters and digits representing an integer with theradix specified by<i>base</i>,optionally preceded by a + or - sign, but not including aninteger suffix.The letters from a (or A) to z (or Z) inclusiveare ascribed the values 10 to 35; only letters whose ascribedvalues are less than that of<i>base</i>are permitted.If the value of<i>base</i>is 16, the wide-character code representations of 0x or 0Xmay optionally precede the sequence of letters and digits,following the sign if present.<p>The subject sequence is defined as the longest initial subsequenceof the input wide-character string,starting with the first non-white-space wide-character code,that is of the expected form.The subject sequence contains no wide-character codes if the inputwide-character stringis empty or consists entirely of white-space wide-character code,or if the firstnon-white-space wide-character code is other than a sign or a permissibleletter or digit.<p>If the subject sequence has the expected form and<i>base</i>is 0, the sequence of wide-character codes starting with thefirst digitis interpreted as an integer constant.If the subject sequence has the expected form and the value of<i>base</i>is between 2 and 36, it is used as the base for conversion,ascribing to each letter its value as given above.If the subject sequence begins with a minus sign, the valueresulting from the conversion is negated.A pointer to the final wide-character string is storedin the object pointed to by<i>endptr</i>,provided that<i>endptr</i>is not a null pointer.<p>In other than the POSIX locale, additional implementation-dependentsubject sequence forms may be accepted.<p>If the subject sequence is empty or does not have the expectedform, no conversion is performed; the value of<i>nptr</i>is stored in the object pointed to by<i>endptr</i>,provided that<i>endptr</i>is not a null pointer.<br><p>The<i>wcstol()</i>function will not change the setting of <b>errno</b>if successful.<p>Because 0, {LONG_MIN} and {LONG_MAX}are returned on error and are also valid returns on success,an application wishing to check for error situations should set<i>errno</i>to 0, then call<i>wcstol()</i>,then check<i>errno</i>.</blockquote><h4><a name = "tag_000_010_638">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>wcstol()</i>returns the converted value, if any.If no conversion could be performed, 0 is returned and<i>errno</i>may be set to indicate the error.If the correct value is outside the range of representable values, {LONG_MAX}or {LONG_MIN} is returned (according to the sign of the value), and<i>errno</i>is set to [ERANGE] .</blockquote><h4><a name = "tag_000_010_639">&nbsp;</a>ERRORS</h4><blockquote>The<i>wcstol()</i>function will fail if:<dl compact><dt>[EINVAL]<dd>The value of<i>base</i>is not supported.<dt>[ERANGE]<dd>The value to be returned is not representable.</dl><p>The<i>wcstol()</i>function may fail if:<dl compact><dt>[EINVAL]<dd>No conversion could be performed.</dl></blockquote><h4><a name = "tag_000_010_640">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_641">&nbsp;</a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_642">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_643">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="iswalpha.html">iswalpha()</a></i>,<i><a href="scanf.html">scanf()</a></i>,<i><a href="wcstod.html">wcstod()</a></i>,<i><a href="wchar.h.html">&lt;wchar.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the MSE working draft.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 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 + -