Friday, March 2, 2018

DELPHI - How get row count in text file

var
  iRowCount : integer;
  F : TextFile;
begin
  ...
  { read row count }
  try
    iRowCount := 0;

    AssignFile( F, EPath.Text + s.Name );
    Reset( F );
    while not EOF( F ) do
      begin
        readln( F, sText );
        inc( iRowCount );
      end;   
     ...       
   finally
     CloseFile( F );
   end;
...

No comments:

Post a Comment