Futurebasic/Language/Reference/read field

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Syntax[edit | edit source]

READ FIELD

Description[edit | edit source]

This statement creates a new relocatable block in memory, reads data from the open file or serial port specified by deviceID into the new block, and returns a handle to the block into handleVar, which must be a long-integer variable or a HANDLE variable. The data in the file (or coming in through the serial port) must be in a particular format in order to be read properly. The first 4 bytes (at the current "file mark" position) must be a long integer which indicates the size of the block to create. This should be immediately followed by the data which is to go into the block. This is the format in which the WRITE FIELD statement writes to a file; almost always, the data you read with READ FIELD will have been created using a WRITE FIELD statement.

Note: Your program is responsible for disposing of the handle returned in handleVar when you're finished using the block. You can use a statement such as DEF DISPOSEH or KILL FIELD to do this.

See Also[edit | edit source]

WRITE FIELD; READ FILE; OPEN; KILL FIELD; DEF DISPOSEH