Hello,
Windows 10
gcc 5.3.0
I'm opening a USB memory stick for read.
I can read the beginning of the stick ok, then I try to reset
the file pointer to another position and fail.
What am I doing wrong?
Thanks.
Regards
Code:
DWORD dwCurrentFilePosition = SetFilePointer(
hdisk, // must have GENERIC_READ and/or GENERIC_WRITE
0, // do not move pointer
NULL, // hdisk is not large enough in needing this pointer
FILE_CURRENT); // provides offset from current position
printf("Current file pointer position: %lu\n", dwCurrentFilePosition);
Code:
// position is a LARGE_INTEGER
position.QuadPart = (__int64)1024;
printf("LowPart:%lu HighPart:%lu\n", position.LowPart, position.HighPart);
dwCurrentFilePosition = SetFilePointerEx(
hdisk, // must have GENERIC_READ and/or GENERIC_WRITE
position, // new position
NULL, // hdisk is not large enough to need this pointer
FILE_CURRENT); //provides offset from current position
printf("New file pointer position: %lu\n", dwCurrentFilePosition);
Code:
Current file pointer position: 512 // this is correct, from previous read
LowPart:1024 HighPart:0
New file pointer position: 1 // should be 1024