delphi写入txt


本文整理自网络,侵删。

 

unit WriteLog;

interface

Uses Windows,SysUtils;

function WriteTxt(strWrite:string):boolean;

implementation

function WriteTxt(strWrite:string):boolean;
var
  wLogFile: TextFile;
  DateTime: TDateTime;
  strTxtName,strContent: string;
begin
  DateTime:=now;
  strTxtName:=ExtractFilePath(paramstr(0))+FormatdateTime('yyyy-mm-dd',DateTime)+'.txt';
  AssignFile(wLogFile, strTxtName);
  if FileExists(strTxtName) then
    Append(wLogFile)
  else
  begin
    ReWrite(wLogFile);
  end;
  strContent:=FormatdateTime('tt',DateTime)+' '+strWrite;
  Writeln(wLogFile, strContent);
  CloseFile(wLogFile);

  Result:=true;
end;

end.

相关阅读 >>

Delphi 用 getenvironmentvariable 获取常用系统环境变量

Delphi xe5 for android ttabcontrol 控件

Delphi2010下安装控件Delphi

Delphi 把单张图片保存到access数据库

Delphi string 常用字串符处理函数

Delphi 生成guid算法的单元

Delphi winapi: getparent、setparent、movewindow - 获取、指定父窗口和移动窗口

Delphi xe5 android 使用system.zip单元释放资源文件

Delphi10.x dpr文件

Delphi tcomport控件从串品读取数据

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...