READ

Top  Previous  Next

Syntax

INT = READ(vFile as FILE | BFILE, var as ANYTYPE)

Description

Reads data from a file opened with the OPENFILE command.

Parameters

vFile - FILE or BFILE successfully open for reading with OPENFILE

var - For ASCII files can be any built in type. For binary files (BFILE) can be any built in type or UDT.

Return value

Returns 0 on success or -1 if the file could not be read.

Remarks

In ASCII mode numeric data can be read sequentially if separated by space, tab, comma or new line characters. The WRITE statement separates numeric data with spaces.

String data can be any length. In ASCII mode READ will continue to read the string character by character until a new line or NULL terminator is found. Be sure to use a large enough string to accommodate the data. READ will overwrite string memory if the data is longer than the dimensioned string.

See Also: OPENFILE, WRITE, GET, PUT

Example usage

READ myfile, nNumber