Libraries
I/O Buffer Source Code
 previous   up   next 

Types
bufferFile
File implementation type for buffered files.

bufferFile

const type: bufferFile

File implementation type for buffered files.


Function Summary
file
openBufferFile (in file: baseFile)
Open a bufferFile based on the given baseFile.
void
close (inout bufferFile: aBufferFile)
Close a bufferFile.
void
flush (inout bufferFile: aBufferFile)
Forces that all buffered data of aBufferFile is sent to its destination.
void
write (inout bufferFile: outBufferFile, in string: stri)
Write the string stri to outBufferFile.
char
getc (inout bufferFile: inBufferFile)
Read a character from inBufferFile.
string
gets (inout bufferFile: inBufferFile, in integer: maxLength)
Read a string with maximum length from inBufferFile.
boolean
eof (in bufferFile: inBufferFile)
Determine the end-of-file indicator.
boolean
hasNext (inout bufferFile: inBufferFile)
Determine if at least one character can be read successfully.
integer
length (inout bufferFile: aBufferFile)
Obtain the length of a aBufferFile.
boolean
seekable (in bufferFile: aBufferFile)
Determine if the file aFile is seekable.
void
seek (inout bufferFile: aBufferFile, in integer: position)
Set the current file position.
integer
tell (in bufferFile: aBufferFile)
Obtain the current file position of aBufferFile.

Function Detail

openBufferFile

const func file: openBufferFile (in file: baseFile)

Open a bufferFile based on the given baseFile.

Returns:
the file opened.

close

const proc: close (inout bufferFile: aBufferFile)

Close a bufferFile.


flush

const proc: flush (inout bufferFile: aBufferFile)

Forces that all buffered data of aBufferFile is sent to its destination.


write

const proc: write (inout bufferFile: outBufferFile, in string: stri)

Write the string stri to outBufferFile.


getc

const func char: getc (inout bufferFile: inBufferFile)

Read a character from inBufferFile.

Returns:
the character read, or EOF at the end of the file.

gets

const func string: gets (inout bufferFile: inBufferFile, in integer: maxLength)

Read a string with maximum length from inBufferFile.

Returns:
the string read.
Raises:
RANGE_ERROR - The parameter maxLength is negative.

eof

const func boolean: eof (in bufferFile: inBufferFile)

Determine the end-of-file indicator. The end-of-file indicator is set if at least one request to read from the file failed.

Returns:
TRUE if the end-of-file indicator is set, FALSE otherwise.

hasNext

const func boolean: hasNext (inout bufferFile: inBufferFile)

Determine if at least one character can be read successfully. This function allows a file to be handled like an iterator.

Returns:
FALSE if getc would return EOF, TRUE otherwise.

length

const func integer: length (inout bufferFile: aBufferFile)

Obtain the length of a aBufferFile. The file length is measured in characters.

Returns:
the length of a file.

seekable

const func boolean: seekable (in bufferFile: aBufferFile)

Determine if the file aFile is seekable. If a file is seekable the functions seek and tell can be used to set and and obtain the current file position.

Returns:
TRUE, if aFile is seekable, FALSE otherwise.

seek

const proc: seek (inout bufferFile: aBufferFile, in integer: position)

Set the current file position. The file position is measured in characters from the start of the file. The first character in the file has the position 1. It is possible to switch between reading and writing a bufferFile (and vice versa) as long as seek() is called in between.

Raises:
RANGE_ERROR - The file position is negative or zero.

tell

const func integer: tell (in bufferFile: aBufferFile)

Obtain the current file position of aBufferFile. The file position is measured in characters from the start of the file. The first character in the file has the position 1.

Returns:
the current file position.


 previous   up   next