delphi笔记:txt读写

来源:互联网 发布:光盘制作软件 编辑:程序博客网 时间:2024/06/11 12:36

procedure TForm1.Button1Click(Sender: TObject);
var
txtf:textfile;
batf:string;
data:string;
begin
    batf:='new.txt';
    data:='abcdeftt';

    if  fileexists(batf) then deletefile(batf); //如果存在,则删除
    assignfile(txtf,batf);  //打开
    rewrite(txtf);          //新建
    writeln(txtf,data);     //写入数据
    closefile(txtf);        //关闭文件

end;

 

 

笔记

原创粉丝点击