Reading a Line from a File

The Insert | File I/O Command | Reading Commands | Read Line menu option places a command in the Edit window that reads a line from the specified file during execution. This command sets the variable specified by the variable ID to 1 (true) or 0 (false) to indicate success (true) or failure (false) of the call. The expression required by this command can be used to delimit the line read in and to automatically fill up variables and references with data read in from the file. Information is read in from the input file up to the next carriage return character.

The syntax of this command in the Edit window is:

<varname> = File/ReadLine,<filepointername>,<expr>

Descriptions for some of the components of this command are:

<varname>
This is the name of the variable that holds the result indicating success or failure of the ReadLine command. It returns "OK" or "EOF".

<filepointername>
This is the name specified for the file pointer when the file was opened.

<expr>
This is the destination variable(s) for the input data. Input data can be delimited by text to allow for ease in parsing incoming lines of data. Variables and feature references should be surrounded by curly brackets.

To access the dialog box associated with this File I / O command:

  1. Open the Edit window.

  2. Place your cursor on the Read Line command.

  3. Press F9.

More:

Sample Code for Read Line