OPENUPDATE

Synopsis
OPENUPDATE filename
(OPENUPDATE filename binarymode)
Description

Opens the file named filename named for reading and writing. The read and write position is initially set to the end of the old file, if any. Each open file has only one position, for both reading and writing. If a file opened for update is both READER and WRITER at the same time, then SETREADPOS also affects WRITEPOS and vice versa. Also, if you alternate reading and writing the same file, you must SETREADPOS between a write and a read, and SETWRITEPOS between a read and a write.

filename can also be the reserved word "clipboard to read/write data to the clipboard just like a file.

The binarymode is a boolean value (TRUE or FALSE). If binarymode is FALSE or not given, then the file is read/written as a text file. That is, the end-of-line sequence is converted from LF to CRLF when written and from CRLF to LF when read. If binarymode is TRUE, then the file is written as a binary file. That is, no end-of-line sequence conversion is performed.

Example
OPENWRITE "dummy.fil
SETWRITE "dummy.fil
PRINT "Hello
PRINT [Good Bye]
SETWRITE []
CLOSE "dummy.fil

OPENUPDATE "dummy.fil
SETREAD "dummy.fil
SETREADPOS 0
SHOW READLIST
[Hello]
SETWRITE "dummy.fil
SETWRITEPOS 7
PRINT [And how are you today]
SETWRITE []
SETREAD "dummy.fil
SETREADPOS 0
REPEAT 3 [SHOW READLIST]
[Hello]
[And how are you today]
CLOSE "dummy.fil
See Also
CLOSE

SourceForge.net Logo