The SetFilePointerEx function moves the file pointer of the specified file to a location determined by the distance and move method. This function is an extended version of the SetFilePointer function.
BOOL SetFilePointerEx(
HANDLE hFile,
LARGE_INTEGER liDistanceToMove,
PLARGE_INTEGER lpNewFilePointer OPTIONAL,
DWORD dwMoveMethod
);
| Parameter | Type | Description |
|---|---|---|
hFile |
HANDLE |
A handle to the file. |
liDistanceToMove |
LARGE_INTEGER |
The amount, in bytes, to move the file pointer. This value can be positive or negative. |
lpNewFilePointer |
PLARGE_INTEGER |
A pointer to a LARGE_INTEGER variable that receives the new file pointer. If this parameter is NULL, the new file pointer is not returned. |
dwMoveMethod |
DWORD |
The starting point for the move. This parameter can be one of the following values:
|
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.
If lpNewFilePointer is not NULL, the value it points to contains the new file pointer. If lpNewFilePointer is NULL, the return value itself contains the new file pointer if the function succeeds.
The SetFilePointerEx function allows you to move the file pointer beyond the current end of the file. If you move the file pointer beyond the end of the file, and then write data, the existing regions of the file between the previous end of the file and the new end of the file are filled with zeros.
Use the FILE_BEGIN, FILE_CURRENT, or FILE_END constants for the dwMoveMethod parameter.
The SetFilePointerEx function is the recommended way to set the file pointer for files that may exceed 4 GB.
|
|---|