FileTools[Text] - Maple Programming Help

Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : Text Subpackage : FileTools/Text/WriteLine

FileTools[Text]

 WriteLine
 write strings to a file or pipe

 Calling Sequence WriteLine(file, str1, str2, ...)

Parameters

 file - file descriptor or filename str1, str2, ... - (optional) one or more Maple strings to be printed

Description

 • The WriteLine(file) command writes the specified Maple expressions to the specified file, separated by newlines, and followed by a newline.
 • The WriteLine function returns a count of the number of characters written.  Due to different character encodings, this number may differ from the number of bytes written to disk.
 • If file is default, the output is written to the current output stream.
 • If file is terminal, the line is written to the top level output stream. The top level output stream is the current output stream that was in effect when Maple was started.
 • If file is the name of an open file, the file descriptor is obtained automatically.  If file is the name of a file that is not open, it is opened automatically.  If file is an invalid descriptor, an error is raised.
 • If no strings are specified, only a newline is printed.

Examples

 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{WriteLine}\right]\left("testfile","This is a test"\right)$
 ${15}$ (1)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{WriteLine}\right]\left("testfile","This is also a test"\right)$
 ${20}$ (2)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{Close}\right]\left("testfile"\right)$
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadLine}\right]\left("testfile"\right)$
 ${"This is a test"}$ (3)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{ReadLine}\right]\left("testfile"\right)$
 ${"This is also a test"}$ (4)
 > $\mathrm{FileTools}\left[\mathrm{Remove}\right]\left("testfile"\right)$