Search                        Top                                  Index
HELP SYSSEEK                                    Revised by Fran Evelyn, July 85

    sysseek(<device>, <pointer>, <mode>);
or
    sysseek(<device>, <pointer>, <mode>, true) -> <position>;

This procedure controls at which byte in a file the next read or write will
operate. It can only be used on 'block I/O' files. SYSSEEK is modelled on the
UNIX 'seek' command, and takes three arguments: a <device>, a <pointer> and a
<mode>.

The <pointer> is an integer which represents the 'address' in bytes of the
point at which the next read or write will take place. The <mode> indicates
how this address is represented. There are six possible modes, represented by
the digits 0-5.

mode = 0 - the address is relative to the start of the file (the first byte
           has address 0).
mode = 1 - the address is relative to the current position (and can therefore
           be negative).
mode = 2 - the address is relative to the byte immediately after the last byte
           in the file.

Thus if D is a file whose current position is C and whose size is S then:

    sysseek(d, n, 1)    is equivalent to    sysseek(d, n + c, 0)
    sysseek(d, n, 2)    is equivalent to    sysseek(d, n + s, 0)

Modes 3, 4 and 5 are the same as 0, 1 and 2 respectively except that the
addresses are in blocks (i.e. multiples of 512 bytes) rather than bytes. Thus

    sysseek(d, n, 3) is equivalent to sysseek(d, n * 512, 0)

For more information on Input/Output procedures see REF SYSIO.

See also HELP
    *SYSOPEN   - returns a device record for an existing disc file
    *SYSCREATE - creates a disc file and returns a device record for the file
    *SYSREAD   - reads from a specified device
    *SYSWRITE  - writes to a specified device