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 system.net.httpclient 下载

Delphi debug和release区别

Delphi异常重启自身

Delphi让listbox实现即指即显功能

Delphi xe可执行文件上启用dep和aslr

Delphi 用stringhelper.split分解字符串

Delphi not 与整数

wmi cim_datafile的33个属性

Delphi 2010 fastmm 内存泄露使用方法

Delphi fmx 把内容复制到粘贴板上支持跨平台

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



打赏

取消

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

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

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

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

评论

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

    暂无评论...