TextFile

files.spad line 131 [edit on github]

This domain provides an implementation of text files. Text is stored in these files using the native character set of the computer.

= : (%, %) -> Boolean
from BasicType
close! : % -> %
from FileCategory(FileName, String)
coerce : % -> OutputForm
from CoercibleTo(OutputForm)
endOfFile? : % -> Boolean

endOfFile?(f) tests whether the file f is positioned after the end of all text. If the file is open for output, then this test is always true.

flush : % -> Void
from FileCategory(FileName, String)
iomode : % -> String
from FileCategory(FileName, String)
latex : % -> String
from SetCategory
name : % -> FileName
from FileCategory(FileName, String)
open : FileName -> %
from FileCategory(FileName, String)
open : (FileName, String) -> %
from FileCategory(FileName, String)
read! : % -> String
from FileCategory(FileName, String)
readIfCan! : % -> Union(String, "failed")

readIfCan!(f) returns a string of the contents of a line from file f, if possible. If f is not readable or if it is positioned at the end of file, then "failed" is returned.

readLine! : % -> String

readLine!(f) returns a string of the contents of a line from the file f.

readLineIfCan! : % -> Union(String, "failed")

readLineIfCan!(f) returns a string of the contents of a line from file f, if possible. If f is not readable or if it is positioned at the end of file, then "failed" is returned.

reopen! : (%, String) -> %
from FileCategory(FileName, String)
write! : (%, String) -> String
from FileCategory(FileName, String)
writeLine! : % -> String

writeLine!(f) finishes the current line in the file f. An empty string is returned. The call writeLine!(f) is equivalent to writeLine!(f,"").

writeLine! : (%, String) -> String

writeLine!(f, s) writes the contents of the string s and finishes the current line in the file f. The value of s is returned.

~= : (%, %) -> Boolean
from BasicType

CoercibleTo(OutputForm)

FileCategory(FileName, String)

SetCategory

BasicType