c - WinAPI using SetfilePointer to test EOF -
hi guys if want test eof using
setfilepointer(fi1, 0, null, file_current) != invalid_set_file_pointer
or ?
setfilepointer(fi1, 1, null, file_current) != invalid_set_file_pointer
neither trick. first won't detect eof, , second moves file pointer guess not want.
you should read file pointer calling setfilepointerex
"move method" of file_current
, distance of zero. , compare against file size, obtained calling getfilesizeex
.
large_integer pos, size; if (!setfilepointerex(hfile, 0, &pos, file_current)) handleerror(); if (!getfilesizeex(hfile, &size)) handleerror(); bool eof = (pos.quadpart == size.quadpart);
Comments
Post a Comment