//创建一个文本文件
procedure TFrmAutomatismBalance.FlatButton3Click(Sender: TObject);
var
TF:TextFile;
PathStr:string;
begin
PathStr:=ExtractFilePath(Application.ExeName)+FormatDateTime(‘yyyy-mm-dd‘,Now())+‘.txt‘ ;
AssignFile(Tf,PathStr);
ReWrite(Tf);
CloseFile(Tf);
end;
//往文本文件里面写入数据
procedure TFrmAutomatismBalance.FlatButton3Click(Sender: TObject);
var
TF:TextFile;
PathStr:string;
begin
PathStr:=ExtractFilePath(Application.ExeName) +FormatDateTime(‘yyyy-mm-dd‘,Now())+‘.txt‘ ;
AssignFile(Tf,PathStr);
Append(Tf);
WriteLn(Tf,‘Creat A TXT‘);
Flush(Tf);
CloseFile(Tf);
end;
时间: 2024-10-11 22:05:52