title: Reading from text file skips first line
body: <p>I'm using strtok to read from a file that looks like this. Thanks to the answer of my last question, the seg fault went away. However, I'm now having a problem of the the read in file, not being read on the first line</p>
  
  <p>Once again: I have a file that looks like this (test.txt)</p>
  
  <pre><code>5f6
  2f6
  </code></pre>
  
  <p>And a c file that looks like this:</p>
  
  <pre><code>#include &lt;ncurses.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(int argc, char * argv[])
  {
      char buf[100];
      char *ptr;
      char *ptr2;
      char *ptr3;
      char *ptr4;
      int a,b,c,d;
      FILE *file;
  
      initscr();
      cbreak();
      noecho();
  
      if (argc &gt; 1)
       {
          file = fopen(argv[1], "r");
          if (file == NULL) //doesn't return null
              return -1;
          while (fgets(buf,100,file) != NULL)
           {
              ptr  = strtok(buf,"f");
              ptr2 = strtok(NULL," ");
              ptr3 = strtok(NULL,"f");
              ptr4 = strtok(NULL," ");
              if (ptr != NULL)
                  a = atoi(ptr);
              if (ptr2 != NULL)
                  b = atoi(ptr2);
              if (ptr3 != NULL)
                  c = atoi(ptr3);
              if (ptr4 != NULL)
                  d = atoi(ptr4);
  
              mvprintw(0,0,"Values are a %d b %d c %d d %d",a,b,c,d);
           }
       }
      refresh();
      getchar();
      endwin();
  
      return 0;
  }
  </code></pre>
  
  <p>from the text file, the values should be(EXPECTED OUTPUT): <code>a = 5, b = 6, c = 2, d = 6;</code></p>
  
  <p>But the program outputs: <code>a = 2, b = 6, c = 0, d = 0</code></p>
  
  <p>I've tried to modify entries of the text file(change the values around), but that doesn't seem to yield any improvement. I've also tried to change directory, re write this code in another directory with a new file (in case it was some sort of a memory issue, but all to no avail.) Any help would be much appreciated.</p>