SetFilePointerEx

Description

Sets the file pointer of a file handle to a specified position.

Parameters

hFile HANDLE

A handle to the file.

lpPositionByte LONG

The position in bytes from the beginning of the file to which the file pointer should be set.

flAttributes FILE_SET_FILE_POINTER_ATTRIBUTES

Specifies whether the file pointer is set in the file or in the process's address space.

Returns

If the function succeeds, it returns a handle to the file. If the function fails, it returns 0.

Example

            
            HANDLE hFile;
            LONG position = 1024;
            DWORD flags = 0;

            hFile = SetFilePointerEx(hFile, position, &flags, NULL);

            if (hFile == INVALID_HANDLE_VALUE) {
                // Handle error
            }