本文整理自网络,侵删。
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 控件
Delphi winapi: getparent、setparent、movewindow - 获取、指定父窗口和移动窗口
Delphi xe5 android 使用system.zip单元释放资源文件
更多相关阅读请进入《Delphi》频道 >>