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.

OSBREAD<br />

Syntax<br />

OSBREAD var FROM file.var [AT byte.expr] LENGTH length.expr [NODELAY]<br />

[ON ERROR statements]<br />

Description<br />

The <strong>UniBasic</strong> OSBREAD command reads data from a file starting at a specified byte<br />

location for a certain length of bytes, and assigns the data to a variable. OSBREAD<br />

performs an operating system block read on a UNIX, or Windows platform file.<br />

Note: Before you use OSBREAD, you must open the file by using the OSOPEN or<br />

OPENSEQ command.<br />

UniData uses the ASCII 0 character [CHAR(0)] as a string-end delimiter. Therefore,<br />

ASCII 0 cannot be used in any string variable within <strong>UniBasic</strong>. OSBREAD converts<br />

CHAR(0) to CHAR(128) when reading a block of data.<br />

Reading from a Named Pipe<br />

Keep these points in mind when you write programs that read from named pipes:<br />

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

Unlike a typical read, reading a named pipe removes the data.<br />

Your application should check the length of var after reading a pipe. The<br />

value returned could be shorter than length.expr.<br />

UniData truncates the data if it is longer than length.expr.<br />

Reading Other Types of Files<br />

Processing of files that are not named pipes is determined by the presence or absence<br />

of the AT clause:<br />

If the AT clause is included, <strong>UniBasic</strong> begins reading from the file at the<br />

offset specified by byte.expr.

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

Saved successfully!

Ooh no, something went wrong!