delphi怎么创建一个文本文件

时间:2022-05-17 01:49:36

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);