title: C - Using strtok gives me only the first word of each line?
body: <p>My code is as follows. I am using a struct and taking in an input text file. I separate it into lines, then attempt to separate each line into its individual words. Using strtok, it is currently only printing the first word of each line. How can I fix this?</p>
  
  <pre><code>typedef struct {
      char linewords[101];
      char separateword[101];
  } line;
  </code></pre>
  
  <p>The following is in main:</p>
  
  <pre><code>line linenum[101];
  char var[101]
  char *strtok(char *str, const char delim);
  
  while fgets(linenum[i].linewords, 101, stdin) != NULL) {
  
      char* strcopy();
      char* strtok();
      strcpy(linenum[i].separateword,linenum[i].linewords);
  
      strtok(linenum[i].separateword, " "); /*line i'm referring to*/
      i++;
      }
  }
  </code></pre>
  
  <p>I apologise in advance for any confusion. What I want is to have it so linenum[i].separateword[0] will return the first word, etc. Is this possible? Or is there another way of splitting my input into words?</p>
  
  <p>Thank you</p>