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 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.

Note: Files encoded in UTF-8 can start with the UTF-8 Byte Order Mark (BOM), a sequence of 0xEF 0xBB 0xBF bytes, also known as UNICODE U+FEFF. When reading files, Genero BDL will ignore the UTF-8 BOM, if it is present at the beginning of the file. This applies to instructions such as LOAD, as well as I/O APIs such as base.Channel.read() and readLine().

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.