[fpc-pascal] Seek with text file
Anthony Walter
sysrpl at gmail.com
Tue Apr 3 13:04:44 CEST 2018
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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180403/aea11f30/attachment.html>
More information about the fpc-pascal
mailing list