[fpc-pascal] read lines at end of file

José Mejuto joshyfun at gmail.com
Tue Apr 12 09:29:34 CEST 2011

Hello FPC-Pascal,

Tuesday, April 12, 2011, 1:09:34 AM, you wrote:

RW> 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 
RW> Hmm, could first have the reader enumerate the number of lines in the
RW> file, then read through the files using the "total number of lines - 4"
RW> variable and then start displaying the lines after that variable has
RW> been reached.  If necessary, I would be happy to see what I can come up
RW> with here and then post it to the mailing list.

Go get the amount of lines of a file you must read the whole file as
each line does not have a fixed size. To put an non programming
example you think in an elevator and I tell you that the elevator can
lift up 600 kilograms. How many people are inside ? You can routhly
calculate that 8 persons as in average one persons is 75 kilograms in
weigth, but what happends if the elevator is filled with childrem
( sometimes called people too :-) ) between 5 and 6 years old ?

Best regards,

More information about the fpc-pascal mailing list