title: EOF is sent prematurely using "fgetc"
body: <p>I am writing a program that prints out the Firefox <code>cookies.sqlite</code> file.</p>
  
  <pre><code>int printfile(FILE* cookiesfile)
  {
      int c;
      //fseek(cookiesfile,0x18260,SEEK_SET);
      do{
          c=fgetc(cookiesfile);
          printf("%c",c);
      }while(c != EOF);
      printf("\n\n%x",c);
      if (ferror(cookiesfile) != 0)printf("\nchareror!\n");
      return 0;
  }
  </code></pre>
  
  <p>The code returns <code>EOF</code> at various points before the end of the file. Opening the file in a hex editor or notepad shows that the file is much larger. The <code>EOF</code> always appears at the same points. Skipping past these points, data is read until the next <code>EOF</code>. Characters that the <code>EOF</code> occurs on have often been fgot previously without any problem (i.e. <code>0x1a</code>, <code>0x13</code>).</p>
  
  <p>Checking the result from <code>ferror()</code> does not help (as no error is present).</p>
  
  <p>I am not sure how to proceed in my debugging process, can someone lead me in the right direction?</p>