The Conroy & Conroy Subroutine Library (2021.3 edition)

TSBasic_File
What: class
Ancestor: TCommon_COM_Interface
File: _COMLists
Layer: 0
Platforms: C++, C#, Pascal (All), PHP, Python

This class provides a minimal basic file interface suitable for level 0 of the subroutine library, where the more full-featured file objects are unavailable. It has the following methods:

Close()
void Close()
procedure Close()
Closes the open file.

EOF
bool EOF()
function EOF() : boolean
Returns true if the current file position is at the end of the file. Returns false otherwise. Note: in Python, this always returns False.

FileName
string FileName()
function FileName : string
Returns the name of the file that was opened.

Open
int Open( const string Name, int Flags )
function Open( const Name : string ; Flags : integer ) : integer
Opens the specified file. Flags indicate how the file is opened.

Open for reading and writingOpen for reading only (supercedes FOF_Read_Write)Open and position at end of fileFile must existCreate new file/overwrite old file
ValueDescription
FOF_Read_Write
FOF_Read_Only
FOF_Append
FOF_Must_Exist
FOF_Create
The method returns 0 if the file is successfully opened, or one of the following values:
ValueMeaning
FErr_Not_FoundFile does not exist.

ReadLn
string ReadLn()
function ReadLn() : string
Returns the next line from the file.

WriteLn
void WriteLn( const string Value )
procedure WriteLn( const Value : string )
Writes the specified text to the file.