Re: Re: Reading a file?


Posted by Denis on October 27, 2000 at 21:58:24:

In Reply to: Re: Reading a file? posted by JEanClaude Servaye on October 27, 2000 at 15:13:31:

When i press a button nothing happens.
here is the code as i iserted it modified code:

var
  F : TextFile;
  A : String;
  N : Integer;
  I : Integer; 
  {you forgot to identify I, maybe i need to identify it not like integer}
  SecondSection : Boolean; 
begin
  AssignFile(F,'new.txt'); {maybe I need to write this 'c:\project1\new.txt' instead of 'new.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);
      StringGrid1.Cells[0,I] := Copy(A,1,N-1);
      A := Copy(A,N+1,Length(A));
      N := Pos(' ',A);
      StringGrid1.Cells[1,I] := Copy(A,1,N-1);
      StringGrid1.Cells[2,I] := Copy(A,N+1,Length(A));
    end;
  end;
end;

P.S can u plz write beside each line a short description ike what it does.


Related Articles and Replies: