io

Functions for general purpose byte-oriented input and output with files.

Summary
ioFunctions for general purpose byte-oriented 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.
flushFlush a file.
openOpen a file with the given name and mode.
readBytesRead bytes 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(f: File)

Close a file.

flush

DECLARE NATIVE FUNCTION flush(f: File)

Flush 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.

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(f: File)
Close a file.
DECLARE NATIVE FUNCTION flush(f: File)
Flush 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 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