title: i need to read a line of comma seperated integers from a textfile and store them into an array
body: <p>i have tried using strtok function but i dont know how to use it</p>
  
  <p>this is the code i read from the net</p>
  
  <pre><code>FILE *ptr = fopen("testdoc.txt", "r");
  
  char nums[100];
  
  fgets(nums,100,ptr);
  const char s[2] = ",";
  char *token;
  token =strtok (nums, s);
  while( token != NULL ) 
     {
    printf( " %s\n", token );
  
    token = strtok(NULL, s);
   }
  </code></pre>
  
  <p>why do we have token = strtok(NULL,s) in the last line?? and how do i store the numbers obtained by token into an array??
  thanks alot, please explain in detail</p>