From RAD Studio API Documentation
Jump to: navigation, search


function FileSeek(Handle: THandle; Offset, Origin: Integer): Integer;
function FileSeek(Handle: THandle; const Offset: Int64; Origin: Integer): Int64;


extern DELPHI_PACKAGE int __fastcall FileSeek(NativeUInt Handle, int Offset, int Origin)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Repositions read/write point.

Use FileSeek to reposition the read/write point in a file that was opened with FileOpen or FileCreate. Handle is the file handle that was returned by FileOpen or FileCreate.

Offset specifies the number of bytes from Origin where the file pointer should be positioned. Origin is a code with three possible values, denoting the beginning of the file, the end of the file, and the current position of the file pointer.

Origin Action


The file pointer is positioned Offset bytes from the beginning of the file.


The file pointer is positioned Offset bytes from its current position.


The file pointer is positioned Offset bytes from the end of the file.

If FileSeek is successful, it returns the new position of the file pointer; otherwise, it returns -1.

Note: Do not mix routines that take or return file handles with those that use Delphi language file variables (typically seen as var F). To move the file pointer in a file specified by a Delphi file variable, use the Seek procedure instead.

See Also

Code Examples