ВУЗ:
Составители:
Рубрика:
27
begin read(f, d); label2.caption:=label2.caption + d end;
closefile(f)
end;
Задача 37. Создать типизированный файл , состоящий из символов,
введённых в окно ввода Edit. Добавить в конец файла символ ′ ! ′.
var Form1: TForm1; f : file of char;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
if not savedialog1.execute then exit;
label1.Caption:=savedialog1.FileName;
assignfile(f, savedialog1.FileName);
rewrite(f);
for i:=1 to length(edit1.Text) do write(f, edit1.text[i]);
closefile(f);
end;
procedure TForm1.Button2Click(Sender: TObject);
var c:char;
begin
if not opendialog1.Execute then exit;
assignfile(f, opendialog1.FileName);
label1.Caption:=opendialog1.FileName;
reset(f);
c:='!'; seek(f, filesize(f)); write(f, c);
closefile(f)
end;
procedure TForm1.Button3Click(Sender: TObject);
var d:char;
begin
if not opendialog1.Execute then exit;
assignfile(f, opendialog1.FileName);
reset(f); label2.Caption:='';
27 begin read(f, d); label2.caption:=label2.caption + d end; closefile(f) end; За д а ча 37. Созд а т ь т ипизирова н н ый ф а йл, сост оя щий из сим волов, введ ён н ых в окн о ввод а Edit. Доб а вит ь в кон ец ф а йла сим вол ′ ! ′. var Form1: TForm1; f : file of char; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin if not savedialog1.execute then exit; label1.Caption:=savedialog1.FileName; assignfile(f, savedialog1.FileName); rewrite(f); for i:=1 to length(edit1.Text) do write(f, edit1.text[i]); closefile(f); end; procedure TForm1.Button2Click(Sender: TObject); var c:char; begin if not opendialog1.Execute then exit; assignfile(f, opendialog1.FileName); label1.Caption:=opendialog1.FileName; reset(f); c:='!'; seek(f, filesize(f)); write(f, c); closefile(f) end; procedure TForm1.Button3Click(Sender: TObject); var d:char; begin if not opendialog1.Execute then exit; assignfile(f, opendialog1.FileName); reset(f); label2.Caption:='';
Страницы
- « первая
- ‹ предыдущая
- …
- 25
- 26
- 27
- 28
- 29
- …
- следующая ›
- последняя »