help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

FileSeek

Set the current file position on a file handle.

Declaration

Source position: line 0

function FileSeek(

  Handle: THandle;

  FOffset: LongInt;

  Origin: LongInt

):LongInt;

function FileSeek(

  Handle: THandle;

  FOffset: Int64;

  Origin: LongInt

):Int64;

Description

FileSeek sets the file pointer on position Offset, starting from Origin. Origin can be one of the following values:

fsFromBeginning
Offset is relative to the first byte of the file. This position is zero-based. i.e. the first byte is at offset 0.
fsFromCurrent
Offset is relative to the current position.
fsFromEnd
Offset is relative to the end of the file. This means that Offset can only be zero or negative in this case.

If successfull, the function returns the new file position, relative to the beginning of the file.

Remark: The abovementioned constants do not exist in Delphi.

Errors

On error, -1 is returned.

See also

FileClose

  

Close a file handle.

FileWrite

  

Write data from a buffer to a given filehandle.

FileCreate

  

Create a new file and return a handle to it.

FileOpen

  

Open an existing file and return a filehandle

FileRead

  

Read data from a filehandle in a buffer.

FileTruncate

  

Truncate an open file to a given size.

Example

Program Example42;

{ This program demonstrates the FileSetAttr function }

Uses sysutils;

Begin
  If FileSetAttr ('ex40.pp',faReadOnly or faHidden)=0 then
    Writeln ('Successfully made file hidden and read-only.')
  else
    Writeln ('Coulnd''t make file hidden and read-only.');
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505