FileTools[Text]

 read a string from a file

Parameters

 file - file descriptor or filename

Description

 • If file is the name of a file that has not been opened, Maple attempts to open the file before reading the character.
 • An error is raised if file is not a valid descriptor or if it is the name of a file that cannot be opened.
 • If the end of the file has been reached, ReadString returns NULL. To determine if the end of file has been reached, use AtEndOfFile.

Examples

 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{WriteString}\right]\left("testfile","This is a test\n"\right)$
 ${15}$ (1)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{Close}\right]\left("testfile"\right):$
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadString}\right]\left("testfile"\right)$
 ${"This"}$ (2)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadString}\right]\left("testfile"\right)$
 ${"is"}$ (3)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadString}\right]\left("testfile"\right)$
 ${"a"}$ (4)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadString}\right]\left("testfile"\right)$
 ${"test"}$ (5)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadString}\right]\left("testfile"\right)$