Monday, March 25, 2019

Delphi ini file

https://www.thoughtco.com/manipulate-ini-files-from-delphi-1058227


//---------------------------------

procedure TForm1.Button1Click(Sender: TObject);
var strl : TStringlist;
begin
//SAVE
strl := TStringList.Create;
strl.Add(Edit1.Text);
strl.SaveToFile('C:\test.txt');
strl.Free;
//LOAD
strl := TStringList.Create;
strl.LoadFromFile('C:\test.txt');
Edit1.Text := strl.strings[0];
strl.Free;
end;

//------------------------------
var
F: TextFile;
S: string;
begin
if OpenDialog1.Execute then
begin
AssignFile(F, OpenDialog1.FileName);
Reset(F);
Readln(F, S);
Edit1.Text := S;
CloseFile(F);
end;
end;

//===============================

var F: TextFile;
begin
if SaveDialog1.Execute then
begin
AssignFile(F, SaveDialog1.FIleName);
Rewrite(F);
Writeln(F, Edit1.Text);
CloseFile(F);
end;






[[]]



https://informatika75.wordpress.com/tag/programiranje/

No comments:

Post a Comment

Коментар: