delphi 写日志函数


本文整理自网络,侵删。

 procedure TFrm_main.writelog(str: string);
var
  F: TextFile;
  S,FilePath: String;
  qFileStream:   TFileStream;
begin
  FilePath := ExtractFilePath(ParamStr(0)) +'logfile.ini';
  If  not FileExists(FilePath)   then
  begin
    qFileStream   :=   TFileStream.Create(FilePath,   fmCreate);//这里用打开写方式。可设其他常量值看帮助。
    qFileStream.Seek(0,   sofromEnd);
    qFileStream.Free;
  end;
  AssignFile(F,   FilePath);
  Append (F);
  Writeln(F,str);
  CloseFile(F);
end;

相关阅读 >>

Delphi 取键盘值

Delphi dataset和json互转函数

Delphi获取系统默认的useragent的方法

Delphi tfilestream 的读写 合并文件

Delphi 如何快速从列表框tlistbox中删除重复项

Delphi byte、pbyte、tbytes的转换

Delphi xe5读取android imei id

winapi 字符及字符串函数(7): ischarlower - 是否是个小写字母

Delphi 实现数据库读取图片文件

Delphi findwindow的一些用法

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



打赏

取消

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

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

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

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

评论

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

    暂无评论...