FileOpen
Previous  Top  Next

Prototype

IntFileHandle:=FileOpen (FileName)

Description

It opens a file in binary mode and it returns the correspondent handle.

Parameters

FileName
: string corresponding to the path of the file to be open.

Returned value

IntFileHandle
: integer value corresponding to the file handle .

Notes

The returned handle can be used as parameter in those functions that work on the files (FileClose, FileRead, …).

Example

// It checks if a file exists  
Esistente:=FileExists ('c:\files\unfile');

// It creates a file if it doesn't exist 
If Esistente=False Then CreateFile('c:\files\unfile');

// It opens the file
UnFile:=FileOpen('c:\files\unfile');

// It places itself in the file
FileSeek(UnFile, 1);

// It writes a byte in the file
FileWrite(UnFile,1);

// It closes the file
FileClose(UnFile);