Scroll to navigation

GOLF(2gg) Development GOLF(2gg)

NAME

file-position - (files)

PURPOSE

Set a position or get a current position for an open file.

SYNTAX

file-position file-id <file id> \

( set <position> ) | ( get <position> ) \
[ status <status> ]

DESCRIPTION

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:

open-file "testwrite" file-id nf 
file-position file-id nf set 100 
...
file-position file-id nf get pos

See also open-file.

SEE ALSO


Files

change-mode 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 documentation

$VERSION $DATE