Returns the end-of-line status of a file, ignoring whitespace.
function SeekEoln: Boolean; overload; function SeekEoln(var F: Text): Boolean; overload;
Boolean SeekEoln(); Boolean SeekEoln(Text F);
In Delphi code, call SeekEoln to determine whether there is only whitespace between the file pointer and the end of the current line. SeekEoln moves the file pointer past any whitespace, leaving it positioned at the end of the current line, the end of the file, or on the next non-whitespace character (whichever comes first). If SeekEoln leaves the file pointer at the end of the current line or at the end of the file, it returns true. Otherwise, it returns false.
SeekEoln can be used only on open text files.
Delphi Examples:
{ Create data with white space at beginning and end of line to demonstrate that SeekEoln is immune to this. } procedure TForm1.Button1Click(Sender: TObject); var f: System.TextFile; j, Y: Integer; s: string; begin AssignFile(f,'TEST.TXT'); Rewrite(f); Writeln(f, ' 1 2 3 4 '); Writeln(f, 'Some text'); Reset(f); Y := 5; while not SeekEoln(f) do // Will skip white space begin Read(f, j); Canvas.TextOut(5, Y, IntToStr(j)); Y := Y + Canvas.TextHeight(IntToStr(j)) + 5; end; Readln(f); // Read line-end marker Readln(f, s); // Read string with line-end marker Canvas.TextOut(5, Y, s); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|