Fileposition – AMT Datasouth PAL User Manual
Page 107
101
fileposition
fileposition
Description
Pushes the offset of a file's read/write pointer onto the operand stack.
Usage
OpenFile
fileposition
PositionInt
OpenFile
File. File object for open file from which to return file's read/write offset.
PositionInt
Integer. Offset of file's read/write pointer from start of file. A value of zero
indicates the pointer points to the first byte of the file.
Comments
This operator provides the programmer with the means of retrieving and, if desired, remembering a
given file position. The programmer can then perform other file operations which may relocate the
file read/write pointer. Upon completion of these operations, the programmer can restore the
pointer to the remembered position by using the setfileposition operator.
Hints
The following example will remember the current position in MyFile, write the string "Hello" at
offset 23 in the file, and then restore the pointer to the original file position.
MyFile fileposition
MyFile 23 setfileposition
MyFile (Hello) writestring
MyFile exch setfileposition