Futurebasic/Language/Reference/read file

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

Syntax[edit | edit source]

READ FILE

Description[edit | edit source]

This statement reads numBytes& bytes from the open file or serial port specified by deviceID (starting at the current "file mark" position), and copies them into memory starting at the address specified by address. This is the fastest way to read large amounts of data from a file; it's also well suited for reading data whose format you may not know in advance.

Example: This program fragment quickly loads an array with the data read from a file. It's assumed that the binary image of the array was previously saved to the file using a statement like WRITE FILE (see the example accompanying the WRITE FILE statement). _

Note: If READ FILE attempts to read past the end of the file (because numBytes& was too large), FB generates an error.

See Also[edit | edit source]

OPEN; READ#; READ FIELD; WRITE FILE