Futurebasic/Language/Reference/read pound

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

Syntax[edit | edit source]

READ

Description[edit | edit source]

This statement reads data from the open file or serial port specified by deviceID, and stores the data into the indicated variable(s). You can read the data into record variables (recVar), into numeric variables (numVar) or into string variables (strVar$), or any combination of these. If you specify recVar or numVar, the statement reads a number of bytes equal to the size of the variable, and stores the bytes directly into the variable's location in memory, without doing any data conversion. If you specify strVar$;len, the statement reads len bytes, and stores them into strVar$ as a Pascal string of length len (len can be any numeric expression, but its value should not exceed 255). The read operation begins at the current location of the "file mark," and the file mark is advanced as each item is read. If READ# attempts to read past the end of the file, FB generates an error. Because READ# copies the file's bytes directly into memory without conversion, it's best suited for reading "binary" information, such as that created by the WRITE# statement. To read file data which is formatted as text, it's usually better to use the INPUT# statement. To read an arbitrary number of bytes into a block of memory, use the READ FILE statement.

See Also[edit | edit source]

WRITE#; INPUT#; READ FILE; EOF; OPEN; SIZEOF