READLINE

Action

Reads a line from a file.

 

Syntax

READLINE (file handle)

 

Parameter

File handle

A numeric expression indicating the file handle of the file to open. Possible values range from 1 to 10.

 

Remarks

READLINE reads a string ending in a carriage return. If successful, the function returns the string without the carriage return.

 

In order to improve read performance, the first READLINE on a file reads the entire file into memory, and subsequent READLINE commands read lines from memory.

 

 

Returns

-4

File not open for reading

-3

File handle not open

-2

Invalid file handle specified

-1

End of file

0

Line read successfully

 

Example

IF Open(3, @LDRIVE + "\CONFIG\SETTINGS.INI")  = 0

   $x = ReadLine(3)

   WHILE @ERROR = 0

      ? "Line read: [" + $x + "]"

      $x = ReadLine(3)

   LOOP

   Close (3)

ELSE

   BEEP

   ? "Config file not opened, error code: [" + @ERROR + "]"

ENDIF