READNEXT
Reads data from an existing text file opened for reading by the OPEN command.
Syntax:
READNEXT x READNEXT x, y READNEXT x,y,z,a,b,c,q
Discussion:
READNEXT is almost identical to READ. The key difference is READ will read the entire data line from the opened file, up to the newline character, while READNEXT reads only enough characters to fill the number of arguments.
For example, if a data file contains a line with this data:
3.0 4.0 5.0
The following two READNEXT commands will read the values 3.0, 4.0, and 5.0 for x, y, and z:
READNEXT x, y READNEXT z
READNEXT is more useful than READ if the line is very long, or the number of arguments is large. READNEXT does not support array variable names as arguments. The workaround is to read the data into a scalar variable and then set the array variable to the scalar variable value in a subsequent line like this:
READNEXT x data(i, j) = x
READNEXT is assuming period as decimal separator. In order to use decimal separator currently selected in Windows settings use READNEXT_LOCALE keyword.
Example:
OPEN "C:\DATA\TEST.DAT" READNEXT x1, x2 READNEXT x3 CLOSE
Related Keywords:
OPEN, CLOSE, READ, READSKIP, READSTRING, READNEXT_LOCALE
Next: