SETREAD

Synopsis
SETREAD filename
Description

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

If you CLOSE the current reader, then the read stream is closed and READER 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
SETWRITE

SourceForge.net Logo