WRITEPOS

Synopsis
WRITEPOS
Description

Outputs the byte position of the current write stream's file as a number. WRITEPOS outputs 0 when the write position is at the beginning of the file.

WRITEPOS outputs -1 when the current write stream is the Commander.

Example

Note that, in the following example, the output from WRITEPOS is stored in a list and shown after the writer is set back to the Commander ([]).

OPENWRITE "example.txt
SETWRITE "example.txt
MAKE "history []
MAKE "history LPUT WRITEPOS :history
PRINT "Hello
MAKE "history LPUT WRITEPOS :history
PRINT [Good Bye]
MAKE "history LPUT WRITEPOS :history
SETWRITE []
CLOSE "example.txt
SHOW :history
[0 7 17]

SourceForge.net Logo