Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.B5Click(Sender: TObject);
- var
- y: integer;
- begin
- assignfile (f,'drzewa.dat');
- rewrite(f);
- For y:= 1 to nr-1 do
- begin
- if not (tab[y].nazwa='..........') then write(f, tab[y]);
- end;
- closefile (f);
- showmessage('Plik zostal pomyslnie utworzony!'); ///////////zapis
- end;
- procedure TForm1.B6Click(Sender: TObject);
- var
- y:integer=0;
- begin
- AssignFile(f, 'drzewa.dat');
- StringGrid1.RowCount:=1;
- try
- Reset(f);
- while not eof(f) do
- begin
- y:=y+1;
- read(f,tab[y]);
- StringGrid1.RowCount:=StringGrid1.RowCount+1;
- StringGrid1.Cells[0,y]:=inttostr(tab[y].id);
- StringGrid1.Cells[1,y]:=tab[y].nazwa;
- StringGrid1.Cells[2,y]:=tab[y].typ;
- StringGrid1.Cells[3,y]:=tab[y].klimat;
- StringGrid1.Cells[4,y]:=tab[y].owoc;
- StringGrid1.Cells[5,y]:=inttostr(tab[y].wiek);
- StringGrid1.Cells[6,y]:=floattostr(tab[y].wysokosc);
- StringGrid1.Cells[7,y]:=floattostr(tab[y].szerokosc);
- end;
- except
- showmessage('Nie udalo sie wczytac pliku!');
- end;
- CloseFile(f);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement