base.Channel.readLine

Read a complete line from the channel.

Syntax

readLine()
  RETURNS STRING

Usage

After opening the channel object, use the readLine() method to read a complete line from the channel.

The readLine() method returns an empty string if the line is empty.

A call to readLine() is blocking until the read operation is complete: The source must write characters, terminate the line with a NL character, and if buffered, it must flush the stream.

The readLine() function returns NULL if end of file is reached. To distinguish empty lines from NULL, you must use the STRING data type. If you use a CHAR or VARCHAR, you will get NULL for empty lines. To detect the end of file, use the isEof() method.

Example

WHILE TRUE
  LET s = ch.readLine()
  IF ch.isEof() THEN EXIT WHILE END IF
  ...
END WHILE

For a complete example, see Example 3: Reading lines from a text file.