Op 03-04-2018 13:04 schreef Anthony Walter:
If the file is not to big you could simply write:
procedure ChangeLastLine(const FileName, NewLine: string);
var
S: TStrings;
begin
S := TStringList.Create;
try
S.LoadFromFile(FileName);
if S.Count > 0 then
S[S.Count - 1] := NewLine
else
S.Add(NewLine);
finally
S.Free;
end;
end;
Don't forget the S.SaveToFile(FileName) just above the finally-line
otherwise nothing is saved back to the file :D
Rik
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal