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写入txt
最新推荐文章于 2020-08-18 11:24:28 发布