Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Wildcard Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
File Source Code
 previous   up   next 

Types
file
Interface type for sequential files.

file

const type: file

Interface type for sequential files. The file interface is implemented with null_file, external_file, utf8_file, utf16_file, socket, echo_file, line_file, dir_file and many other types.


Function Summary
void
write (inout file: outFile, in string: stri)
Write a string to a file.
void
writeln (inout file: outFile)
Write end-of-line to a file.
void
writeln (inout file: outFile, in string: stri)
Write a string followed by end-of-line to a file.
void
close (inout file: aFile)
Close a file.
void
flush (inout file: outFile)
Forces that all buffered data of outFile is sent to its destination.
char
getc (inout file: inFile)
Read a character from a file.
string
gets (inout file: inFile, in integer: maxLength)
Read a string with a maximum length from a file.
string
getwd (inout file: inFile)
Read a word from a file.
string
getln (inout file: inFile)
Read a line from a file.
boolean
eof (in file: inFile)
Determine the end-of-file indicator.
boolean
hasNext (in file: inFile)
Determine if at least one character can be read successfully.
integer
length (in file: aFile)
Obtain the length of a file.
void
seek (inout file: aFile, in integer: position)
Set the current file position.
integer
tell (in file: aFile)
Obtain the current file position.
integer
compare (in file: file1, in file: file2)
Compare two file values.
integer
hashCode (in file: aFile)
Compute the hash value of a file.
void
read (inout file: inFile, inout string: aVar)
Read a word from inFile into aVar.
void
read (inout file: inFile, inout string: aVar, in string: defaultValue)
Read a word from inFile into aVar or use defaultValue.
void
readln (inout file: inFile, inout string: aVar)
Read a line from inFile into aVar.
void
readln (inout file: inFile, inout string: aVar, in string: defaultValue)
Read a line from inFile into aVar or use defaultValue.
void
readln (inout file: inFile)
Discard a line from a file.
void
copyFile (inout file: source, inout file: dest)
Copy a file from source to destination.

Function Detail

write

const proc: write (inout file: outFile, in string: stri)

Write a string to a file.


writeln

const proc: writeln (inout file: outFile)

Write end-of-line to a file. The implementation function decides how writing end-of-line is done. It can be done by writing '\n', but other solutions are also possible.


writeln

const proc: writeln (inout file: outFile, in string: stri)

Write a string followed by end-of-line to a file. The implementation function decides how writing end-of-line is done. It can be done by writing '\n', but other solutions are also possible.


close

const proc: close (inout file: aFile)

Close a file.


flush

const proc: flush (inout file: outFile)

Forces that all buffered data of outFile is sent to its destination. Depending on the implementation type this causes data to be sent to the file system, screen, network or other destination.


getc

const func char: getc (inout file: inFile)

Read a character from a file.

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

gets

const func string: gets (inout file: inFile, in integer: maxLength)

Read a string with a maximum length from a file.

Returns:
the string read.

getwd

const func string: getwd (inout file: inFile)

Read a word from a file. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. The word ending characters are not copied into the string. When the function is left inFile.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).

Returns:
the word read.

getln

const func string: getln (inout file: inFile)

Read a line from a file. The function reads a string up to end-of-line or EOF. The line ending characters are not copied into the string. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).

Returns:
the line read.

eof

const func boolean: eof (in file: inFile)

Determine the end-of-file indicator. The end-of-file indicator is set when 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 (in file: inFile)

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 (in file: aFile)

Obtain the length of a file. The file length is measured in bytes.

Returns:
the length of a file.
Raises:
RANGE_ERROR - The file length does not fit into an integer value.
FILE_ERROR - The implementation type of aFile is not seekable or a system function returns an error or the file length reported by the system is negative.

seek

const proc: seek (inout file: aFile, in integer: position)

Set the current file position. The file position is measured in bytes from the start of the file. The first byte in the file has the position 1.

Raises:
FILE_ERROR - The implementation type of aFile is not seekable.

tell

const func integer: tell (in file: aFile)

Obtain the current file position. The file position is measured in bytes from the start of the file. The first byte in the file has the position 1.

Returns:
the current file position.
Raises:
RANGE_ERROR - The file position does not fit into an integer value.
FILE_ERROR - The implementation type of aFile is not seekable or a system function returns an error or the file position reported by the system is negative.

compare

const func integer: compare (in file: file1, in file: file2)

Compare two file values. This function does neither compare file contents nor file names. The order of two files is determined by comparing the memory positions of their internal data representation. Therefore the result of compare is arbitrary and may change when the program is executed again. Inside a program the result of compare is consistent and can be used to maintain hash tables.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in file: aFile)

Compute the hash value of a file.

Returns:
the hash value.

read

const proc: read (inout file: inFile, inout string: aVar)

Read a word from inFile into aVar. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. The word ending character is not copied into the string. When the function is left inFile.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).


read

const proc: read (inout file: inFile, inout string: aVar, in string: defaultValue)

Read a word from inFile into aVar or use defaultValue. Before reading the word it skips spaces and tabs. The function accepts words ending with " ", "\t", end-of-line or EOF. When the word is empty defaultValue is assigned to aVar. The word ending character is not copied into the string. When the function is left inFile.bufferChar contains the word ending character (' ', '\t', '\n' or EOF).


readln

const proc: readln (inout file: inFile, inout string: aVar)

Read a line from inFile into aVar. The function reads a string up to end-of-line or EOF. The line ending character is not copied into the string. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).


readln

const proc: readln (inout file: inFile, inout string: aVar, in string: defaultValue)

Read a line from inFile into aVar or use defaultValue. The function reads a string up to end-of-line or EOF. When the line is empty defaultValue is assigned to aVar. The line ending character is not copied into the string. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).


readln

const proc: readln (inout file: inFile)

Discard a line from a file. The function discards characters up to end-of-line or EOF. When the function is left inFile.bufferChar contains the line ending character ('\n' or EOF).


copyFile

const proc: copyFile (inout file: source, inout file: dest)

Copy a file from source to destination. The source file is copied to dest until end-of-file is reached.



 previous   up   next