class File
Provides text file input and output functions.
Global Functions
int Copy (const Path, const Path) | Copies the specified file. |
int Delete (const Path) | Deletes the specified file. |
int Exists (const Path) | Returns true if the file specified by the given Path exists. |
int Rename (const Path, const Path) | Renames the specified file. |
Constructors
File () | Constructs a new file object. |
Methods
int Close () | Closes the file. |
Flush () | Writes the contents of the output buffer to disk. |
int Open (const Path, int) | Opens a file with the specified mode and at the given path. |
string ReadChars (const int) | Reads the specified number of characters from the file. |
string ReadLine () | Reads a single text line from the file. |
string[] ReadLines () | Reads all text lines from the file and returns them as a one-dimensional string array. |
string ReadText () | Reads the full contents of the file and returns it as a string. |
int WriteLine (const string) | Writes the specified string into the file and appends return / line feed characters. |
int WriteLines (const string[]) | Writes all strings from the array into the file. |
int WriteText (const string) | Writes the specified string into the file. |
Properties
int EndOfFile () | Returns true if the end of the file has been reached. |
int Length () | Returns the length of the currently opened file. |
int Locator () | Retrieves the file locator, which is the current read / write position in the file. |
Locator (const int) | Sets the file locator to the specified byte address in the file. |
Reference
function int Copy (const Path source, const Path dest) |
Copies the specified file. This function will fail if the source path doesn't exist or the destination path already exists. |
function int Delete (const Path path) |
Deletes the specified file. This will fail if the specified Path represents a directory. |
function int Exists (const Path path) |
Returns true if the file specified by the given Path exists. |
function int Rename (const Path oldName, const Path newName) |
Renames the specified file. This may also be used to rename a directory or move it to a new destination, as long as the destination is on the same volume. |
method File () |
Constructs a new file object. |
method int Close () |
Closes the file. |
method Flush () |
Writes the contents of the output buffer to disk. |
method int Open (const Path path, int mode) |
Opens a file with the specified mode and at the given path. Mode constants are File::kRead, File::kWrite, File::kAppend, File::kReadWriteExisting, File::kReadWriteEmpty, File::kReadWriteAppend. |
method string ReadChars (const int length) |
Reads the specified number of characters from the file. |
method string ReadLine () |
Reads a single text line from the file. |
method string[] ReadLines () |
Reads all text lines from the file and returns them as a one-dimensional string array. |
method string ReadText () |
Reads the full contents of the file and returns it as a string. |
method int WriteLine (const string text) |
Writes the specified string into the file and appends return / line feed characters. |
method int WriteLines (const string[] lines) |
Writes all strings from the array into the file. This will fail if the array is multi-dimensional. |
method int WriteText (const string text) |
Writes the specified string into the file. |
accessor int EndOfFile () |
Returns true if the end of the file has been reached. |
accessor int Length () |
Returns the length of the currently opened file. Calling this may alter the current file locator. |
accessor int Locator () |
Retrieves the file locator, which is the current read / write position in the file. |
accessor Locator (const int position) |
Sets the file locator to the specified byte address in the file. |