Hi Jose, all. <div>I've now (at last!) started using your last4 lines program. Thanks a lot- it works really well and even on a 100M log file it is really really fast - faster than 1 msec, which I didn't believe until I timed it using gettickcount. Also it doesn't generate much disk i/o. Reading the whole log file would take longer and generate disk i/o - I'm guessing that it doesn't read the file ... so not sure how it works...?</div>
<div><div><div>
<br><div>I've had to make few changes eg increasing the buffer size, because the lines in my log file are of varying length ans some are rather long eg > 1000 bytes.<br><div><br></div><div>Two issues I've encountered, I'm getting an exception abort (efopenerror) if no file exists and also I get an exception abort if looking for the last 4 lines and it overflows the buffer. Can you pls suggest some code to stop these, and eg return a 0 length string if either happens? <br>
<div><br></div><div>Thanks again for this help.</div>
<div><br></div><div>John <br><div><br></div><div><div class="gmail_quote">On 14 April 2011 16:03, José Mejuto <span dir="ltr"><<a href="mailto:joshyfun@gmail.com" target="_blank">joshyfun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello John,<br>
<br>
Thursday, April 14, 2011, 3:26:48 PM, you wrote:<br>
<br>
JL> Hi there, thanks for this - looks a very complete function. I hadn't<br>
JL> realised that best way would be to use streaming! I'm trying to write a 3<br>
JL> line test program that just gets last 4 lines of a file.<br>
<br>
JL> I'm not very familiar with obj pascal or streaming. What vars & uses<br>
JL> clauses do I need to call your function?<br>
<br>
JL> this is what I have - I still gets some error messages, missing tfilestream,<br>
JL> tfilelist.<br>
<br>
Just only "Classes". You can do the same using regular pascal files<br>
but to me TStream is more clear.<br>
<br>
--<br>
Best regards,<br>
<font color="#888888"> José<br>
<br>
</font></blockquote></div><br></div></div>
</div></div></div></div></div>