Prototype
IntFileHandle:=TextFileOpen (FileName,Bool)
Description
It open a text file and returns the handle.
Parameters
FileName : string that corresponds to the name and path of the file to open.
Bool: logical value true or false. If it is true the access to the file it happens in writing, otherwise in reading
Returned value
IntFileHandle: integer value that corresponds at the handle of the file.
Notes
The returned handle can be used as parameter in the functions that operate on the files (TextFileClose, TextFileRead, TextFileWrite,
).
Example
// Check if a file exists
Esistente:=FileExists ('c:\text\first.txt');
// If it doesn't exist it creates it
If Esistente=False Then CreateFile('c:\text\first.txt');
// Opens the file
UnFile:=TextFileOpen('c:\text\first.txt', true);
// Writes a string in the file
TextFileWrite(UnFile,'Aldo Rossi');
// Closes the file
TextFileClose(UnFile);