Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 19
Reading and Writing Data
When you open a file, the current-record and next-record pointers point to the first byte
in the file:
A READ[X] or WRITE[X] procedure call always begins at the byte pointed to by the
next-record pointer. The next-record pointer is advanced on each READ[X] or
WRITE[X] call to provide automatic sequential access to the file.
Normally, the next-record pointer is rounded up to an even value. However, if the file
was created as an odd-unstructured file (by setting bit <15> of the FILE_CREATE_
options parameter to 1) then the next-record pointer is advanced by exactly the
number of bytes transferred.
Following the read or write operation, the current-record pointer indicates the first byte
affected by the read or write operation. The following example transfers 512 bytes of
data from the disk file starting at relative byte 0 into a buffer in memory called
SBUFFER.
STRING .SBUFFER[0:511];
.
.
RCOUNT := 512;
CALL READX(FILENUM,
SBUFFER,
RCOUNT,
NUMXFERRED);
VST008.VSD