综合

img LuckyJan

TextFile读写

发表于2004/10/9 11:01:00  1178人阅读

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;

阅读全文
0 0

相关文章推荐

img
取 消
img