title: C++: fopen() returns handle to empty file
body: <p>I'm getting a strange file handle from <code>fopen</code>; the pointer itself isn't NULL, but the file it represents has no size, and <code>feof(file)</code> is already set...  what could be causing this?</p>
  
  <p>(I triple checked the file itself, it exists, has data, and the file's permissions are okay... and <code>filename</code> is set to "source/test_file.object.txt")</p>
  
  <pre><code>bool tagFile(const char * filename){
      FILE * file = fopen(filename, "r");
      if(file == NULL){                        // file is not NULL
          printf("   Couldn't open the file %s", filename);
          return false;
      }
      int size = fseek(file, 0, SEEK_END); // size is 0
      rewind(file);
      while(feof(file)){
  
          ....  // never executes because feof(file) fails
      }
  }
  0x002cc410  // value of 'file' in the debugger
      _ptr=0x00000000 &lt;Bad Ptr&gt; 
      _cnt=0 
      _base=0x00000000 &lt;Bad Ptr&gt;
      _flag = 1
      _file = 3
  </code></pre>