FANDOM


Syntax

.SEEK streamnumber offset

(.SEEK streamnumber offset mode)

(.SEEK streamnumber)

Explanation

.SEEK positions the read/write pointer of the specified stream to the numerical byte position given as its second input. The output of the .SEEK command is the current stream position. Note that it is possible to position beyond the end of a file.

If .SEEK is supplied with an optional third input, this input affects the way the pointer is positioned:

0 Position = offset; equivalent to .SEEK streamnumber offset

1 Position = Current position + offset

2 Position = End-of-file + offset

Using .SEEK with the stream number only as input yields the current position of the stream pointer.

See also .READ and .WRITE.

Example

The following example opens a file for reading and writing, seeks to position 32 and writes the letter "X at that position.

TO WRITE.X.AT.32 :NAME

MAKE "STREAM (OPEN :NAME "RW)
MAKE "DATA BYTEARRAY 1
ASET :DATA 0 #H58
.SEEK :STREAM 32
.WRITE :STREAM :DATA 1
CLOSE :STREAM

END

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.