OPENAPPEND is documented to set the file position to the end of the file so that all writes are appended to the file. However, after calling OPENAPPEND, WRITEPOS outputs 0, instead of the position of the end of the file. FMSLogo seems to delay setting the WRITEPOS to the end until the first time the file is written to.
This bug prevents, for example, a programmer from determining if the file is empty after calling OPENAPPEND.
I have reproduced this bug in UCBLogo 6.0 and FMSLogo 6.10.0. It's likely that this bug was inherited from UCBLogo into MSWLogo into FMSLogo.
How Reproducible
Every time
Steps to Reproduce
Run the following proceedure
TO RUNTEST
; Create a file with a line of text.
OPENWRITE "testfile.txt
SETWRITE "testfile.txt
PRINT "Hello
SETWRITE []
CLOSE "testfile.txt
; Open for appending
OPENAPPEND "testfile.txt
SETWRITE "testfile.txt
; Show initial write position
MAKE "writepos WRITEPOS
SETWRITE []
SHOW :WRITEPOS
CLOSE "testfile.txt
END
What Happens
The SHOW :WRITEPOS prints 0.
Expected Result
The SHOW :WRITEPOS prints 7 (Hello = 5 + end-of-line=2 ).
Fixed by [r5161]. The fix will be included in FMSLogo 7.7.0.
Related
Commit: [r5161]