[fpc-pascal] read lines at end of file
José Mejuto
joshyfun at gmail.com
Mon Apr 11 20:45:06 CEST 2011
Hello FPC-Pascal,
Monday, April 11, 2011, 7:55:01 PM, you wrote:
>> The idea is easy, instead reading forward, you read backwards in
>> blocks of, say, 64 Kb and count lines back. If not enougth lines you
>> insert another 64 Kb before and so on. Average line is usually less
>> than 100 bytes, so each 64 Kb are usually more than 600 lines. Read of
>> 64 Kb usually takes the same time as read any lower amount when the
>> block is 4096 bytes aligned.
MG> You can not really read backwards. You can use
MG> something like TFileStream.Seek(-4096,soEnd).
I think that the "read backwards in blocks" already stated that fact,
but nice annotation.
--
Best regards,
José
More information about the fpc-pascal
mailing list