WRITESEQ, WRITESEQF |
![]() ![]() ![]() |
The WRITESEQ statement writes a string array to a directory file record previously opened for sequential access. WRITESEQF is identical except that it force writes the data to disk.
Format
WRITESEQ var TO file.var {ON ERROR statement(s)} {THEN statement(s)} {ELSE statement(s)}
where
The keyword TO may be replaced by ON. At least one of the THEN and ELSE clauses must be present.
The data in var is written to the record at the current file position, overwriting any data already present. The THEN clause is executed if the write is successful.
The ELSE clause is executed if the WRITESEQ operation fails.
If a fatal error occurs, the ON ERROR clause is executed. The STATUS() function can be used to establish the cause of the error. If no ON ERROR clause is present, a fatal error causes an abort.
The FILEINFO() function can be used with key FL$LINE to determine the field number that will be written by the next WRITESEQ. This information is not valid if the SEEK, READBLK or WRITEBLK statements have been used.
The WRITESEQF statement is identical to WRITESEQ except that execution of the next QMBasic statement does not occur until the data has been written to disk. With WRITESEQ, the data may still be in internal buffers.
Example
WRITESEQ REC TO STOCK.LIST ELSE ABORT "Write error"
This statement writes the data in REC to the record open for sequential access via the STOCK.LIST file variable.
See also: CLOSESEQ, NOBUF, OPENSEQ, READBLK, READCSV, READSEQ, WEOFSEQ, WRITEBLK, WRITECSV |