Commands

read

Supported By

Syntax

read from object [at offset] [for length] [until data]

Object yields an object with an appropriate I/O manager. Offset yields an integer identifying the position where reading starts. Length yields a non-negative integer identifying the length of data to be read. Data yields the last data to be read.

Examples

read from file "MyData" at 4 for 20
read from file "MyData" until tab
read from file "MyData" at -20 until eof

Description

The read command reads from the specified object, which must be opened already with the open command, into the local variable it. Reading starts at the specified offset or, if no offset is specified, from where the last read or write left off. A negative offset indicates an offset from the end of the file, while a positive offset indicates an offset from the beginning of the file. Reading continues until either the specified data is read, or the specified length of data is read, whichever occurs first. If neither is specified, reading continues until the end of a line (if the text I/O method is used) or the end of file (if the binary I/O method is used).

Compatibility

HyperTalk uses only the first character of data to find a stopping point. OpenXION uses the whole data.

HyperTalk converts null characters to spaces when reading. OpenXION refuses to do such an unspeakable thing.

See Also

open, write, truncate, close, file, URL, text, binary