Name

SeekEoln Function

Syntax

function SeekEoln(var F: Text = Input): Boolean

Description

SeekEoln skips over white space characters and then returns True if the text file is at the end of file or end of line. Eoln interprets a carriage return (#13) as the end of line. It returns False if there is more text to read and the next character is not a carriage return. SeekEoln is not a real function.

Errors

  • If the file F is not open, SeekEoln reports runtime error 103.

  • The file must have been opened by calling Reset. If the file F was opened by calling Rewrite or Append, SeekEoln reports runtime error 104.

Example

// Read a series of numbers on one line of text.
// Return the sum of those numbers.
function SumLine: Double;
var
  X: Double;
begin
  Write('Number list: ');
  Result := 0.0;
  while not SeekEoln do
  begin
    Read(X);
    Result := Result + X;
  end;
end;

See Also

Eoln Function, IOResult Function, Reset Procedure, SeekEof Procedure, TextFile Type

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.