SETWRITE

Synopsis
SETWRITE filename
Description

Sets the write stream to the file named filename. The write stream is used by PRINT, SHOW, etc. The file must already be open with OPENWRITE, OPENAPPEND, or OPENUPDATE. If the input is the empty list, then the write stream becomes the Commander, as usual. Changing the write stream does not close the file that was previously the write stream, so it is possible to alternate between files.

If you CLOSE the current writer, then the write stream is closed and WRITER is changed back to the Commander.

Example
OPENWRITE "example.txt
SETWRITE "example.txt
PRINT "Hello
PRINT [Good Bye]
SETWRITE []
CLOSE "example.txt

OPENREAD "example.txt
SETREAD "example.txt
REPEAT 2 [SHOW READLIST]
[Hello]
[Good Bye]
SETREAD []
CLOSE "example.txt
See Also
SETREAD
WRITER

SourceForge.net Logo