title: Strtok usage, code not working
body: <p>I am trying to use <code>strtok()</code>. Following is the piece of code that I wrote. It does not work but prints <code>",  '"</code> infinitely.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  
  int main(){
  char str[]="this, by the way, is a 'sample'";
  char *tokens;
  tokens = strtok(str, ", '");
  //printf("%s\n",tokens);
  //printf("%s\n", str);
  while(tokens!=NULL)
  {
      printf("%s\n", tokens);
      tokens = (NULL, ", '");
  }
  return 0;
  }
  </code></pre>
  
  <p>Following is the code from a <code>strtok()</code> manual page, which works perfectly fine.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main ()
  {
    char str[] ="- This, a sample string.";
    char * pch;
    printf ("Splitting string \"%s\" into tokens:\n",str);
    pch = strtok (str," ,.-");
    while (pch != NULL)
    {
      printf ("%s\n",pch);
      pch = strtok (NULL, " ,.-");
    }
    return 0;
  }
  </code></pre>
  
  <p>I feel I have done the exact same thing. Can't figure out the fault in my code. Could someone please point out.</p>