[fpc-pascal] Seek with text file

Rik van Kekem rik at graficalc.nl
Tue Apr 3 14:17:01 CEST 2018


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 array of strings?

Yes, TStringList is a TList with strings.
Internally it's indeed an array of strings.

 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 be
72*1000=70MB. For current computers with memory in the GB this is not 
large at all. TStringList would also be fast to read individual files.

If you however would need to do this for say 2000 files in a row, it 
could become slow and you would need to code it differently to make it 
more efficient. But for just a few individual files this is the easiest 
method.

Rik



More information about the fpc-pascal mailing list