Re: Reading a file?


Posted by JEanClaude Servaye on October 27, 2000 at 15:13:31:

In Reply to: Reading a file? posted by Denis on October 27, 2000 at 04:14:08:

var
  F : TextFile;
  A : String;
  N : Integer;
  SecondSection : Boolean;
begin
  Assign(F,'YourTextFile.Txt');
  Reset(F);
  SecondSection := False;
  A := '';
  I := 0;
  While not Eof(F) do begin
    If A := '------' then SecondSection := True;
    ReadLn(F,A);
    If SecondSection then begin
      N := Pos(' ',A);
      StrinGrid.Cells[0,I] := Copy(A,1,N-1);
      A := Copy(A,N+1,Length(A));
      N := Pos(' ',A);
      StrinGrid.Cells[1,I] := Copy(A,1,N-1);
      StrinGrid.Cells[2,I] := Copy(A,N+1,Length(A));
    end;
  end;
end;


Related Articles and Replies: