TextFile读写
2006-02-04 13:51:09 来源:WEB开发网核心提示:function readFromFile:string;var s,s2:string; F:TextFile; begin OpenDialog1.FileName:=''; OpenDialog1.Filter:='*.xml|*.xml'; s:='';
function readFromFile:string;
var s,s2:string; F:TextFile;
begin
OpenDialog1.FileName:='';
OpenDialog1.Filter:='*.xml|*.xml';
s:=''; result:='';
if not OpenDialog1.Execute then exit;
assignfile(F,OpenDialog1.FileName);
try
Reset(F);
while not Eof(F) do
begin
Readln(F, s2);
s:=s+s2;
end;
result:=s;
finally
closefile(f);
end;
end;
PRocedure writeToFile(s:string);
var F:TextFile;
begin
assignfile(f,SaveDialog1.fileName);
try
rewrite(f);
writeln(f,s1);
finally
closefile(f);
end;
end;
[]
更多精彩
赞助商链接