textio

Functions for general purpose text input and output with files.

Summary
textioFunctions for general purpose text input and output with files.
Enumerations
ModeMode to use when opening a file.
Types
TextFileOpaque type representing a text file on disk.
Exceptions
TextioExceptionGeneral exception for errors raised by this module.
TextioException.InvalidFileAn invalid (NIL) file was used.
TextioException.WriteAn error occurred while writing to a file.
Variables
stdinThe standard input file.
stdoutThe standard output file.
stderrThe standard error file.
Functions
closeClose a file.
openOpen a file with the given name and mode.
readLineRead a line of text from a file.
seekEndSeek to the end of a file.
seekStartSeek to the start of a file.
truncateTruncate the file at the current position.
writeLineWrite a string, followed by a newline, to a file.

Enumerations

Mode

Mode to use when opening a file.

Values

readread only
writeread or write

Types

TextFile

Opaque type representing a text file on disk.

Exceptions

TextioException

General exception for errors raised by this module.

TextioException.InvalidFile

An invalid (NIL) file was used.

TextioException.Write

An error occurred while writing to a file.

Variables

stdin

The standard input file.

stdout

The standard output file.

stderr

The standard error file.

Functions

close

DECLARE NATIVE FUNCTION close(f: TextFile)

Close a file.

open

DECLARE NATIVE FUNCTION open(name: String,
mode: Mode): TextFile

Open a file with the given name and mode.

readLine

DECLARE NATIVE FUNCTION readLine(f: TextFile,
OUT s: String): Boolean

Read a line of text from a file.

Returns

FALSE if there are no more lines in the file, otherwise TRUE.

seekEnd

DECLARE NATIVE FUNCTION seekEnd(f: TextFile)

Seek to the end of a file.

seekStart

DECLARE NATIVE FUNCTION seekStart(f: TextFile)

Seek to the start of a file.

truncate

DECLARE NATIVE FUNCTION truncate(f: TextFile)

Truncate the file at the current position.

writeLine

DECLARE NATIVE FUNCTION writeLine(f: TextFile,
s: String)

Write a string, followed by a newline, to a file.

DECLARE NATIVE FUNCTION close(f: TextFile)
Close a file.
DECLARE NATIVE FUNCTION open(name: String,
mode: Mode): TextFile
Open a file with the given name and mode.
DECLARE NATIVE FUNCTION readLine(f: TextFile,
OUT s: String): Boolean
Read a line of text from a file.
DECLARE NATIVE FUNCTION seekEnd(f: TextFile)
Seek to the end of a file.
DECLARE NATIVE FUNCTION seekStart(f: TextFile)
Seek to the start of a file.
DECLARE NATIVE FUNCTION truncate(f: TextFile)
Truncate the file at the current position.
DECLARE NATIVE FUNCTION writeLine(f: TextFile,
s: String)
Write a string, followed by a newline, to a file.
Close