title: How does C handle EOF?
body: <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      FILE* f=fopen("book2.txt","r");
      char a[200];
      while(!feof(f))
      {
          fscanf(f,"%s",a);
          printf("%s ",a);
          printf("%d\n",ftell(f));
      }
      fclose(f);
      return 0;
  }   
  </code></pre>
  
  <p>I have the code above. book2.txt contains "abcdef abcdef" with the cursor move to a newline(ie:abcdef abcdef\n). I get the results below.</p>
  
  <pre><code>abcdef 6
  abcdef 13
  abcdef 19
  </code></pre>
  
  <p>I expect to get</p>
  
  <pre><code>abcdef 6
  abcdef 13
  15
  </code></pre>
  
  <p>What am I doing wrong?</p>