Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

wcstoll.html 7.1KB

3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>wcstoll (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="wcstoll (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="wcstoll (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdlib.html#Stdlib" rel="up" title="Stdlib">
  16. <link href="wcstoul.html#wcstoul" rel="next" title="wcstoul">
  17. <link href="wcstol.html#wcstol" rel="prev" title="wcstol">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="wcstoll"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="wcstoul.html#wcstoul" accesskey="n" rel="next">wcstoul</a>, Previous: <a href="wcstol.html#wcstol" accesskey="p" rel="prev">wcstol</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="wcstoll_002c-wcstoll_005fl_002d_002d_002dwide-string-to-long-long"></a>
  54. <h3 class="section">2.45 <code>wcstoll</code>, <code>wcstoll_l</code>&mdash;wide string to long long</h3>
  55. <a name="index-wcstoll"></a>
  56. <a name="index-wcstoll_005fl"></a>
  57. <a name="index-_005fwcstoll_005fr"></a>
  58. <p><strong>Synopsis</strong>
  59. </p><div class="example">
  60. <pre class="example">#include &lt;wchar.h&gt;
  61. long long wcstoll(const wchar_t *__restrict <var>s</var>,
  62. wchar_t **__restrict <var>ptr</var>,int <var>base</var>);
  63. #include &lt;wchar.h&gt;
  64. long long wcstoll_l(const wchar_t *__restrict <var>s</var>,
  65. wchar_t **__restrict <var>ptr</var>, int <var>base</var>,
  66. locale_t <var>locale</var>);
  67. long long _wcstoll_r(void *<var>reent</var>, const wchar_t *<var>s</var>,
  68. wchar_t **<var>ptr</var>, int <var>base</var>);
  69. </pre></div>
  70. <p><strong>Description</strong><br>
  71. The function <code>wcstoll</code> converts the wide string <code>*<var>s</var></code> to
  72. a <code>long long</code>. First, it breaks down the string into three parts:
  73. leading whitespace, which is ignored; a subject string consisting
  74. of characters resembling an integer in the radix specified by <var>base</var>;
  75. and a trailing portion consisting of zero or more unparseable characters,
  76. and always including the terminating null character. Then, it attempts
  77. to convert the subject string into a <code>long long</code> and returns the
  78. result.
  79. </p>
  80. <p>If the value of <var>base</var> is 0, the subject string is expected to look
  81. like a normal C integer constant: an optional sign, a possible &lsquo;<code>0x</code>&rsquo;
  82. indicating a hexadecimal base, and a number. If <var>base</var> is between
  83. 2 and 36, the expected form of the subject is a sequence of letters
  84. and digits representing an integer in the radix specified by <var>base</var>,
  85. with an optional plus or minus sign. The letters <code>a</code>&ndash;<code>z</code> (or,
  86. equivalently, <code>A</code>&ndash;<code>Z</code>) are used to signify values from 10 to 35;
  87. only letters whose ascribed values are less than <var>base</var> are
  88. permitted. If <var>base</var> is 16, a leading <code>0x</code> is permitted.
  89. </p>
  90. <p>The subject sequence is the longest initial sequence of the input
  91. string that has the expected form, starting with the first
  92. non-whitespace character. If the string is empty or consists entirely
  93. of whitespace, or if the first non-whitespace character is not a
  94. permissible letter or digit, the subject string is empty.
  95. </p>
  96. <p>If the subject string is acceptable, and the value of <var>base</var> is zero,
  97. <code>wcstoll</code> attempts to determine the radix from the input string. A
  98. string with a leading <code>0x</code> is treated as a hexadecimal value; a string with
  99. a leading 0 and no <code>x</code> is treated as octal; all other strings are
  100. treated as decimal. If <var>base</var> is between 2 and 36, it is used as the
  101. conversion radix, as described above. If the subject string begins with
  102. a minus sign, the value is negated. Finally, a pointer to the first
  103. character past the converted subject string is stored in <var>ptr</var>, if
  104. <var>ptr</var> is not <code>NULL</code>.
  105. </p>
  106. <p>If the subject string is empty (or not in acceptable form), no conversion
  107. is performed and the value of <var>s</var> is stored in <var>ptr</var> (if <var>ptr</var> is
  108. not <code>NULL</code>).
  109. </p>
  110. <p>The alternate function <code>_wcstoll_r</code> is a reentrant version. The
  111. extra argument <var>reent</var> is a pointer to a reentrancy structure.
  112. </p>
  113. <p><code>wcstoll_l</code> is like <code>wcstoll</code> but performs the conversion based on the
  114. locale specified by the locale object locale. If <var>locale</var> is
  115. LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
  116. </p>
  117. <br>
  118. <p><strong>Returns</strong><br>
  119. <code>wcstoll</code>, <code>wcstoll_l</code> return the converted value, if any. If no
  120. conversion was made, 0 is returned.
  121. </p>
  122. <p><code>wcstoll</code>, <code>wcstoll_l</code> return <code>LONG_LONG_MAX</code> or <code>LONG_LONG_MIN</code>
  123. if the magnitude of the converted value is too large, and sets <code>errno</code>
  124. to <code>ERANGE</code>.
  125. </p>
  126. <br>
  127. <p><strong>Portability</strong><br>
  128. <code>wcstoll</code> is ANSI.
  129. <code>wcstoll_l</code> is a GNU extension.
  130. </p>
  131. <p>No supporting OS subroutines are required.
  132. </p>
  133. <br>
  134. <hr>
  135. <div class="header">
  136. <p>
  137. Next: <a href="wcstoul.html#wcstoul" accesskey="n" rel="next">wcstoul</a>, Previous: <a href="wcstol.html#wcstol" accesskey="p" rel="prev">wcstol</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  138. </div>
  139. </body>
  140. </html>