READBLK |
![]() ![]() ![]() |
The READBLK statement reads a given number of bytes from the current file position in a record previously opened using OPENSEQ.
Format
READBLK var FROM file.var, bytes {ON ERROR statement(s)} {THEN statement(s)} {ELSE statement(s)}
where
At least one of the THEN and ELSE clauses must be present.
The THEN clause is executed if the READBLK is successful.
The ELSE clause is executed if the READBLK fails. The STATUS()function will indicate the cause of the error.
The ON ERROR clause is executed for serious fault conditions such as errors in a file's internal control structures. The STATUS() function will return an error number. If no ON ERROR clause is present, an abort would occur.
If file.var refers to a serial port opened using OPENSEQ, the READBLK statement reads up to bytes bytes of data from the port but does not wait if there is less than the requested number of bytes available.
Example
READBLK VAR FROM SEQ.F, 100 THEN ...processing statements... END ELSE DISPLAY "Data block not read" END
This program fragment reads 100 bytes from the a file previously opened to file variable SEQ.F into variable VAR.
See also: CLOSESEQ, NOBUF, OPENSEQ, READCSV, READSEQ, SEEK, WEOFSEQ, WRITEBLK, WRITECSV, WRITESEQ, WRITESEQF |