Purpose: Set a position or get a current position for an open file.
file-position file-id <file id> \
( set <position> ) | ( get <position> ) \
[ status <status> ]
Copied!
file-position will set or get position for a file opened with open-file, where <file id> is an open file identifier.
If "set" clause is used, file position is set to <position> (with 0 being the first byte).
If "get" clause is used, file position is obtained in <position> (with 0 being the first byte).
<status> number in "status" clause will be GG_OKAY if set/get succeeded, GG_ERR_OPEN if file not open, or GG_ERR_POSITION if not.
Note that setting position past the last byte of file is okay for writing - in this case the bytes between the end of file and the <position> are filled with null-bytes when the write operation occurs.
Examples
Open file "testwrite" and set file byte position to 100, then obtain it later: