Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. procedure TForm1.B5Click(Sender: TObject);
  2. var
  3. y: integer;
  4. begin
  5. assignfile (f,'drzewa.dat');
  6. rewrite(f);
  7. For y:= 1 to nr-1 do
  8. begin
  9. if not (tab[y].nazwa='..........') then write(f, tab[y]);
  10. end;
  11. closefile (f);
  12. showmessage('Plik zostal pomyslnie utworzony!'); ///////////zapis
  13. end;
  14.  
  15. procedure TForm1.B6Click(Sender: TObject);
  16. var
  17. y:integer=0;
  18. begin
  19. AssignFile(f, 'drzewa.dat');
  20. StringGrid1.RowCount:=1;
  21. try
  22. Reset(f);
  23. while not eof(f) do
  24. begin
  25. y:=y+1;
  26. read(f,tab[y]);
  27. StringGrid1.RowCount:=StringGrid1.RowCount+1;
  28. StringGrid1.Cells[0,y]:=inttostr(tab[y].id);
  29. StringGrid1.Cells[1,y]:=tab[y].nazwa;
  30. StringGrid1.Cells[2,y]:=tab[y].typ;
  31. StringGrid1.Cells[3,y]:=tab[y].klimat;
  32. StringGrid1.Cells[4,y]:=tab[y].owoc;
  33. StringGrid1.Cells[5,y]:=inttostr(tab[y].wiek);
  34. StringGrid1.Cells[6,y]:=floattostr(tab[y].wysokosc);
  35. StringGrid1.Cells[7,y]:=floattostr(tab[y].szerokosc);
  36. end;
  37. except
  38. showmessage('Nie udalo sie wczytac pliku!');
  39. end;
  40. CloseFile(f);
  41. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement