您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

125 行
5.6KB

  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>wcstok (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="wcstok (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="wcstok (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="Wchar-strings.html#Wchar-strings" rel="up" title="Wchar strings">
  16. <link href="wcswidth.html#wcswidth" rel="next" title="wcswidth">
  17. <link href="wcsstr.html#wcsstr" rel="prev" title="wcsstr">
  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="wcstok"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="wcswidth.html#wcswidth" accesskey="n" rel="next">wcswidth</a>, Previous: <a href="wcsstr.html#wcsstr" accesskey="p" rel="prev">wcsstr</a>, Up: <a href="Wchar-strings.html#Wchar-strings" accesskey="u" rel="up">Wchar strings</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="wcstok_002d_002d_002dget-next-token-from-a-string"></a>
  54. <h3 class="section">6.27 <code>wcstok</code>&mdash;get next token from a string</h3>
  55. <a name="index-wcstok"></a>
  56. <p><strong>Synopsis</strong>
  57. </p><div class="example">
  58. <pre class="example">#include &lt;wchar.h&gt;
  59. wchar_t *wcstok(wchar_t *__restrict <var>source</var>,
  60. const wchar_t *__restrict <var>delimiters</var>,
  61. wchar_t **__restrict <var>lasts</var>);
  62. </pre></div>
  63. <p><strong>Description</strong><br>
  64. The <code>wcstok</code> function is the wide-character equivalent of the
  65. <code>strtok_r</code> function (which in turn is the same as the <code>strtok</code>
  66. function with an added argument to make it thread-safe).
  67. </p>
  68. <p>The <code>wcstok</code> function is used to isolate (one at a time)
  69. sequential tokens in a null-terminated wide-character string,
  70. <code>*<var>source</var></code>. A token is defined as a substring not containing
  71. any wide-characters from <code>*<var>delimiters</var></code>.
  72. </p>
  73. <p>The first time that <code>wcstok</code> is called, <code>*<var>source</var></code> should
  74. be specified with the wide-character string to be searched, and
  75. <code>*<var>lasts</var></code>&ndash;but not <code>lasts</code>, which must be non-NULL&ndash;may be
  76. random; subsequent calls, wishing to obtain further tokens from
  77. the same string, should pass a null pointer for <code>*<var>source</var></code>
  78. instead but must supply <code>*<var>lasts</var></code> unchanged from the last
  79. call. The separator wide-character string, <code>*<var>delimiters</var></code>,
  80. must be supplied each time and may change between calls.
  81. A pointer to placeholder <code>*<var>lasts</var></code> must be supplied by
  82. the caller, and is set each time as needed to save the state
  83. by <code>wcstok</code>. Every call to <code>wcstok</code> with <code>*<var>source</var></code>
  84. == <code>NULL</code> must pass the value of <code>*<var>lasts</var></code> as last set
  85. by <code>wcstok</code>.
  86. </p>
  87. <p>The <code>wcstok</code> function returns a pointer to the beginning of each
  88. subsequent token in the string, after replacing the separator
  89. wide-character itself with a null wide-character. When no more tokens
  90. remain, a null pointer is returned.
  91. </p>
  92. <br>
  93. <p><strong>Returns</strong><br>
  94. <code>wcstok</code> returns a pointer to the first wide character of a token, or
  95. <code>NULL</code> if there is no token.
  96. </p>
  97. <br>
  98. <p><strong>Notes</strong><br>
  99. <code>wcstok</code> is thread-safe (unlike <code>strtok</code>, but like <code>strtok_r</code>).
  100. <code>wcstok</code> writes into the string being searched.
  101. </p>
  102. <br>
  103. <p><strong>Portability</strong><br>
  104. <code>wcstok</code> is C99 and POSIX.1-2001.
  105. </p>
  106. <p><code>wcstok</code> requires no supporting OS subroutines.
  107. </p>
  108. <br>
  109. <hr>
  110. <div class="header">
  111. <p>
  112. Next: <a href="wcswidth.html#wcswidth" accesskey="n" rel="next">wcswidth</a>, Previous: <a href="wcsstr.html#wcsstr" accesskey="p" rel="prev">wcsstr</a>, Up: <a href="Wchar-strings.html#Wchar-strings" accesskey="u" rel="up">Wchar strings</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>
  113. </div>
  114. </body>
  115. </html>