c++ - Is there no GetFilePointer(Ex) Windows API function? -


i trying debug program manipulates file. example, set file-pointer offset 4 (using base of 0), seems starting @ offset 5 instead.

to try figure out happening, want put in line print out current file pointer (i’m not using ide little project, notepad2 , command-line). unfortunately there not seem windows api function retrieve current file pointer, 1 set it.

i’m recall being able find current file pointer in pascal (in dos), how can current file pointer determined in c++ in windows?

unlike functions, provide both getter , setter (in read-write sense), there indeed no getfilepointer or getfilepointerex.

however value can retrieved calling setfilepointer(ex). 2 setfilepointer functions return return/output setfilepointer, have make sure specify offset of 0, and file_current mode. way, moves 0 bytes is, returns (i can’t vouch whether or not wastes cpu cycles , ram perform zero-move, think have optimized not so).

yes, inconsistent , confusing (and redundant , poorly designed), can wrap in own getfilepointer(ex) function:

dword    getfilepointer   (handle hfile) {     return setfilepointer(hfile, 0, null, file_current); }   longlong getfilepointerex (handle hfile) {     large_integer liofs={0};     large_integer linew={0};     setfilepointerex(hfile, liofs, &linew, file_current);     return linew.quadpart; } 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -