, and everything doesn't have
to fit in a few K of ram anymore 😊
-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of
Rik van Kekem
Sent: Tuesday, April 03, 2018 8:17 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Seek with
On 03/04/18 12:45, Rik van Kekem wrote:
From the code-snippet from Anthony you can see it's really easy to use.
1000 lines of about average 70 characters per lines would
be72*1000=70MB.
72 kB, not MB. Big enough to give some very old systems problems if they
used a Windows component as an e
Op 03-04-2018 13:58 schreef James Richters:
Thank you for the advice and for the example. I don't know what is considered a
large file.. these files can be maybe about 1000 lines long, most will be less,
would this solution be suitable for files of this size?
Is Tstringlist something like an a
ssage-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of
Rik van Kekem
Sent: Tuesday, April 03, 2018 7:20 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Seek with text file
Op 03-04-2018 13:04 schreef Anthony Walter:
> If the file is not to big y
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] := N
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
Op 03-04-2018 12:03 schreef James Richters:
So then I tried
Var Myfile: file of String;
Mydata:String;
Assign(myfile,'test.txt');
Reset(myfile);
Seek(myfile,FILESIZE(myfile)-1);
Write(myfile,'New Line'+mydata);
Close(myfile);
And what d
I am trying to figure out how I can remove the last line of a text file to
replace it with a new one. I can do this with typed files with seek... but I
am confused on how I could do this with just a text file.
If I use:
Var Myfile: Text;
Mydata:String;
Assign(myfile,'test.txt'