Overview

File

dynamic File :: {}

The File object can be used to open and manipulate files. This is a default object that does not need to be loaded.

Variables

Type Name Description
Pointer ptr

The pointer object referencing the file stream.

Char mode

The mode in which the file has been openned, either read or write.

Methods

Return Params Description
Constructor init(String filename, Char mode = 'r')

Opens up a file in either read ('r'), write ('w'), or append ('a') mode.

Void write(String s)

Writes a line of text to an openned file.

String readLine()

Reads the subsequent line of text from the file, returns 'null' if the file has reached its end.

String readAll()

Reads the entire contents of the file, returning them as a string.

String read(Number length = 1)

Reads the next chars of a given length.

Void close()

Closes the file, deallocating the pointer's memory.