Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.85 KB

SetFilePointerEx.md

File metadata and controls

67 lines (45 loc) · 1.85 KB

Home

Function name : SetFilePointerEx

Group: File Management - Library: kernel32


Moves the file pointer of the specified file.


Declaration:

BOOL WINAPI SetFilePointerEx(
  HANDLE hFile,
  LARGE_INTEGER liDistanceToMove,
  PLARGE_INTEGER lpNewFilePointer,
  DWORD dwMoveMethod
);  

FoxPro declaration:

DECLARE INTEGER SetFilePointerEx IN kernel32;
	INTEGER hFile,;
	LONG liDistanceToMoveLo,;
	LONG liDistanceToMoveHi,;
	STRING @lpNewFilePointer,;
	LONG dwMoveMethod
  

Parameters:

hFile [in] A handle to the file. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right.

liDistanceToMove [in] The number of bytes to move the file pointer.

lpNewFilePointer [out, optional] A pointer to a variable to receive the new file pointer.

dwMoveMethod [in] The starting point for the file pointer move.


Return value:

If the function succeeds, the return value is nonzero.


Comments:

Note that the number of parameters is different in C and VFP declarations for this function.

My first intention was to declare the second parameter, liDistanceToMove, as STRING @, which is the pointer to string. This approach worked in similar situations before but failed in this particular case.

Calvin Hsia in his blog's entry explains why this function must be declared in VFP with rather five input parameters versus four regular ones.

The long integer (8 bytes) input parameter liDistanceToMove is passed to this function as two separate input parameters of LONG type (4 bytes each).