title: Why does strtok interact like this with scanf?
body: <p>So my shell project has been coming along, but my latest speedbump is introducing user input. I'm trying to tokenize an input string, but after the first token <code>strtok</code> only returns NULL. But if I hard-write the string in the program, everything works flawlessly. How I can I treat the user input so that <code>strtok</code> will tokenize the whole string (instead of the first)?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main ()
  {
    char input[100];
    scanf("%s", input); //input entered is "echo 1 2 3 4"
    char *temp=strtok(input, " "); //this is "echo"
    printf("temp1: %s\n", temp);
    temp=strtok(NULL, " "); //this is (null)
    printf("temp2: %s\n", temp); 
  
  }
  </code></pre>