Unlike most functions that provide both getter and setter (in the sense of read-write), there really is no GetFilePointer or GetFilePointerEx .
However, the value can be obtained by calling SetFilePointer (Ex) . The two SetFilePointer functions return return / output from SetFilePointer , but you must make sure that the mode is set to offset 0 , and FILE_CURRENT . Thus, it moves 0 bytes from where it is, and then returns (I cannot vouch for whether it discards the CPU and RAM cycles for zero movement, but I think they are optimized to not do this) .
Yes, this is inconsistent and confusing (and redundantly and poorly designed), but you can wrap it in your 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; }
source share