写ini更方便呀 with Tinifile.create('ipaddress.ini') do begin writestring('application','ipaddress','127.0.0.1'); end;
//可以用一个打开文件文本框,这样交互性更好些 var F: TextFile; {F为你所创建的文本文件} S: string; {S为你所要的IP地址字符串} begin if OpenDialog1.Execute then { Display Open dialog box } begin AssignFile(F, OpenDialog1.FileName); { File selected in dialog } Reset(F); Readln(F, S); { Read first line of file } Edit1.Text := S; { Put string in a TEdit control } CloseFile(F); end; end;
with Tinifile.create('ipaddress.ini') do
begin
writestring('application','ipaddress','127.0.0.1');
end;
var
F: TextFile; {F为你所创建的文本文件}
S: string; {S为你所要的IP地址字符串}
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(F, OpenDialog1.FileName); { File selected in dialog }
Reset(F);
Readln(F, S); { Read first line of file }
Edit1.Text := S; { Put string in a TEdit control }
CloseFile(F);
end;
end;