: Set a position or get a current position for an open file.
file-position file-id <file id> \
( set <position> ) | ( get [ define ] <position> ) \
[ status [ define ] <status> ]
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>.
If "get" clause is used, file position is obtained in <position>, which can be created with optional "define".
The optional <status> in "status" clause will be VV_OKAY if set/get succeeded, or VV_ERR_POSITION if not. <status> can be created with optional "define".
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.
Open file "testwrite" and set file byte position to 100, then obtain it later:
open-file "testwrite" file-id define nf
file-position file-id nf set 100
file-position file-id nf get define pos
See also open-file
( close-file copy-file delete-file file-position file_storage file_uploading lock-file open-file read-file read-line rename-file stat-file temporary_file uniq-file unlock-file write-file
) SEE ALL