On 04/11/2011 12:32 PM, John Lee wrote:
Need to read the last 4 lines (txt) of a very large log file 100M
bytes, 100k lines or more lots of times - of course I can read
through the file in the normal way but this is rather slow. Is there a
way to 'read lines from the end'? I note that unix tail or its port to
windows does this very fast so guess there must be a fast way to do it
in pascal too?
TIA for any ideas John
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Hmm, could first have the reader enumerate the number of lines in the
file, then read through the files using the "total number of lines - 4"
variable and then start displaying the lines after that variable has
been reached. If necessary, I would be happy to see what I can come up
with here and then post it to the mailing list.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal