Du kannst eine Zeile an eine Logdatei z.B. so anhängen:
Delphi-Quellcode:
const
CRLF : string = #13#10 ;
procedure AddToLog(LogFile: string; Msg: string);
var
FLogStream: TStream;
begin
if (not FileExists(LogFile)) then
begin
ForceDirectories(ExtractFilePath(LogFile)) ;
FLogStream:= TFileStream.Create(LogFile,fmCreate);
end
else
begin
FLogStream:= TFileStream.Create(LogFile,fmOpenReadWrite);
end;
FLogStream.Seek(0,soFromEnd) ;
Msg := Msg + CRLF ;
FLogStream.Write(Pointer(Msg)^,Length(Msg)*SizeOf(Char)) ;
FreeAndNil(FLogStream) ;
end;