11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

STATUS Function Return Values<br />

After you execute OSBREAD, the STATUS function returns one of the values<br />

described in the following table.<br />

Examples<br />

In the following example, the program statement reads 10,000 bytes of the file RFILE<br />

starting from the beginning of the file. The program assigns the data it reads to the<br />

variable TEST.<br />

1-549 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

OSBREAD TEST FROM 'RFILE' AT 0 LENGTH 10000<br />

In the next example, the program segment reads 15,000 bytes from an NTFS or<br />

UNIX file, starting at the first byte. It then converts ASCII value 10 (a line feed) to a<br />

value mark and processes each line sequentially.<br />

OSBREAD BLOCK FROM INPUT.DIR AT 0 LENGTH 15000<br />

CONVERT CHAR(10) TO @FM IN BLOCK<br />

LOOP<br />

REMOVE REC FROM BLOCK SETTING MORE.RECS<br />

GOSUB PROCESS.REC:<br />

WHILE MORE.RECS REPEAT<br />

Related <strong>Commands</strong><br />

<strong>UniBasic</strong><br />

Value Description<br />

0 The read was successful.<br />

1 The file name is invalid.<br />

2 Access is denied by the operating system.<br />

3 The file does not exist.<br />

4 An unknown error occurred.<br />

STATUS Function Return Values<br />

CLOSESEQ, OPENSEQ, OSBWRITE, OSCLOSE, OSDELETE, OSOPEN,<br />

READSEQ, WRITESEQ, WRITESEQF

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!