io

Functions for general purpose input and output with files.

Summary
ioFunctions for general purpose input and output with files.
Enumerations
ModeMode to use when opening a file.
SeekBasePosition to base seek position on.
Types
FileOpaque type representing a file on disk.
Exceptions
IoExceptionGeneral exception for errors raised by this module.
IoException.InvalidFileAn invalid (NIL) file was used.
IoException.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.
fprintPrint a string, followed by a newline, to a file.
openOpen a file with the given name and mode.
readBytesRead bytes from a file.
readLineRead a line of text from a file.
seekSeek to a specific position within a file.
tellReturn the current file pointer position.
truncateTruncate the file at the current position.
writeWrite characters to a file.
writeBytesWrite bytes to a file.

Enumerations

Mode

Mode to use when opening a file.

Values

readread only
writeread or write

SeekBase

Position to base seek position on.

Values

absoluteset absolute position
relativeset position relative to current
fromEndset position relative to end

Types

File

Opaque type representing a file on disk.

Exceptions

IoException

General exception for errors raised by this module.

IoException.InvalidFile

An invalid (NIL) file was used.

IoException.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(INOUT f: File)

Close a file.

fprint

DECLARE NATIVE FUNCTION fprint(f: File,
s: String)

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

open

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

Open a file with the given name and mode.

readBytes

DECLARE NATIVE FUNCTION readBytes(f: File,
count: Number): Bytes

Read bytes from a file.

readLine

DECLARE NATIVE FUNCTION readLine(f: File,
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.

seek

DECLARE NATIVE FUNCTION seek(f: File,
offset: Number,
whence: SeekBase DEFAULT SeekBase.absolute)

Seek to a specific position within a file.

tell

DECLARE NATIVE FUNCTION tell(f: File): Number

Return the current file pointer position.

truncate

DECLARE NATIVE FUNCTION truncate(f: File)

Truncate the file at the current position.

write

DECLARE NATIVE FUNCTION write(f: File,
s: String)

Write characters to a file.  No newline is written.

writeBytes

DECLARE NATIVE FUNCTION writeBytes(f: File,
b: Bytes)

Write bytes to a file.

DECLARE NATIVE FUNCTION close(INOUT f: File)
Close a file.
DECLARE NATIVE FUNCTION fprint(f: File,
s: String)
Print a string, followed by a newline, to a file.
DECLARE NATIVE FUNCTION open(name: String,
mode: Mode): File
Open a file with the given name and mode.
DECLARE NATIVE FUNCTION readBytes(f: File,
count: Number): Bytes
Read bytes from a file.
DECLARE NATIVE FUNCTION readLine(f: File,
OUT s: String): Boolean
Read a line of text from a file.
DECLARE NATIVE FUNCTION seek(f: File,
offset: Number,
whence: SeekBase DEFAULT SeekBase.absolute)
Seek to a specific position within a file.
DECLARE NATIVE FUNCTION tell(f: File): Number
Return the current file pointer position.
DECLARE NATIVE FUNCTION truncate(f: File)
Truncate the file at the current position.
DECLARE NATIVE FUNCTION write(f: File,
s: String)
Write characters to a file.
DECLARE NATIVE FUNCTION writeBytes(f: File,
b: Bytes)
Write bytes to a file.
Close