The File class gives you the ability to
open, close, read and write files. To use it, simply create an instance
named the file name you wish to open and call it's open method.
Properties
Methods
-
void dispose() |
Closes the file and disposes itself.
|
-
void showStr(string
strBuf) |
Prints the file name (object name)
to strBuf.
|
-
heapPtr open([number
mode]) |
Opens the file.
If mode is specified, it opens
it with mode as it's mode, otherwise, it uses fOPENFAIL as it's
mode. Upon success, it returns a pointer to the object, otherwise,
it returns NULL.
The modes are as follows:
fOPENFAIL |
open
or fail: Try to open file, abort if not possible |
fOPENCREATE |
open
or create: Try to open file, create it if it doesn't
exist |
fCREATE |
create:
Create the file, destroying any content it might have
had |
|
-
void write(string(s)
putStrings) |
Writes the specified strings to
the file.
If the file is not open, it opens
it with the default mode. It then writes all the strings given
as parameters to the it.
|
-
number read(string
strBuf, number maxSize) |
Reads a string from the file.
If the file is not open, it creates
it. It then writes reads a string. If the string length exceeds
maxSize, only maxSize is read. It returns the number of bytes
read.
|
-
void close() |
Closes the file and sets it's
handle to NULL.
|
|