delphi笔记:txt读写

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;

 

 

笔记

你可能感兴趣的:(Delphi技术)