0

Here is simple code for determine size of file, but for some reason _ftelli64 gives me 0(but file size is >0).

I check f for !=NULL, and check return value of _fseeki64 for =0. Where is my mistake?

FILE* f = _tfopen(fileName, _T("rb"));
if(f != NULL)
{
    int res= _fseeki64(f,0,SEEK_END);  // 0 == success
    __int64 file_size = _ftelli64(f);
    _fseeki64(f, 0, SEEK_SET);
}

seems something wrong with file, because reading .ppt file gives me file size >0.

mrgloom
  • 20,061
  • 36
  • 171
  • 301
  • Have you tried that in a small dedicated test program? In the main program, there could a error in other code parts. – deviantfan Jul 07 '14 at 06:53
  • 1
    That code doesn't look C++ code. It looks more a platform-specific C code using non-standard library. Please, use the right labels. – Gonmator Jul 07 '14 at 07:25
  • Possible duplicate: http://stackoverflow.com/questions/4034227/on-windows-fseeki64-does-not-seek-to-seek-end-correctly-for-large-files – pdw Jul 07 '14 at 08:25

0 Answers0