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

📄 strtok.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>  <meta name="generator" content=  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">  <title>strtok</title>  <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table>  <tr>  <td>  <div class="body-content">  <div class="header-box">    <a href="../index.html">cppreference.com</a> &gt; <a href=    "index.html">Standard C String and Character</a> &gt; <a href=    "strtok.html">strtok</a>  </div>  <div class="name-format">    strtok  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;string.h&gt;  char *strtok( char *str1, const char *str2 );</pre>  <p>The strtok() function returns a pointer to the next  &quot;token&quot; in <em>str1</em>, where <em>str2</em> contains the  delimiters that determine the token. strtok() returns  <strong>NULL</strong> if no token is found. In order to convert a  string to tokens, the first call to strtok() should have  <em>str1</em> point to the string to be tokenized. All calls after  this should have <em>str1</em> be <strong>NULL</strong>.</p>  <p>For example:</p>  <pre class="example-code">   char str[] = &quot;now # is the time for all # good men to come to the # aid of their country&quot;;   char delims[] = &quot;#&quot;;   char *result = <strong>NULL</strong>;   result = strtok( str, delims );   while( result != <strong>NULL</strong> ) {       printf( &quot;result is \&quot;%s\&quot;\n&quot;, result );       result = strtok( <strong>NULL</strong>, delims );   }            </pre>  <p>The above code will display the following output:</p>  <pre class="example-code">   result is &quot;now &quot;   result is &quot; is the time for all &quot;   result is &quot; good men to come to the &quot;   result is &quot; aid of their country&quot;          </pre>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="strchr.html">strchr</a><br>    <a href="strcspn.html">strcspn</a><br>    <a href="strpbrk.html">strpbrk</a><br>    <a href="strrchr.html">strrchr</a><br>    <a href="strspn.html">strspn</a><br>    <a href="strstr.html">strstr</a>  </div>  </div>  </td>    </tr>  </table></body></html>

⌨️ 快捷键说明

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