TEXT.readFile

Reads a file into a TEXT locator.

Syntax

readFile(
    path STRING )
  1. path is the path the file to be loaded.

Usage

This method reads content from the specified file into a TEXT locator.

If the file is not found or if it cannot be read, the error -8087 is raised.

Important: The character set used in the file must match the current application locale.
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

MAIN
  DEFINE t TEXT
  LOCATE t IN MEMORY
  CALL t.readFile("mydata")
END MAIN