System.SysUtils.FileSeek

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

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

Description

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

0

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

1

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

2

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