开发学院软件开发Delphi TextFile读写 阅读

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;

Tags:TextFile 读写

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
更多精彩
    赞助商链接

    热点阅读
      焦点图片
        最新推荐
          精彩阅读