Next Value On Line

Read/Write Block - File

Description

The Next Value On Line block reads the next value from the current line of the indicated file. At the end of the line it is necessary to explicitly advance to the next line to continue.

Escapes

If there is not another value to read a Read Escape Code will occur.

Examples

Consider a text file with a variable quantity of numbers on each line:

This block list reads each of the numbers in the file and lists them.

The list begins by offering a file open dialog. If a file is chosen the file is reset for reading. While the file has not yet come to an end it does a series of steps. First it tries to read from the current line forever. Each value read is put into a list. Eventually there will be no information on the line so a read escape occurs and the program flow transitions to the recover block. The recover block confirms that the problem is a read escapecode. If it is and the file is not yet finished then it advances to the next line. If the exception is something else the escape is re-issued. When the end of the file is eventually found the file is closed and "Done" is written at the end of the list. The resulting list looks like this:

Related Topics

Value
Advance To Next Line