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 

msdn documentation

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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -