Hi Everybody,

I'm trying to read line-feed (ASCII #10) terminated lines from a file 
(think UNIX file), not the usual CRLF (ASCII #13 #10) terminated 
lines.

What I'm doing at the moment is to `Read' 1 char at a time into a var 
until I hit an LF + then display the string to the user. While this 
works, it is sloooowwwwwwwwww when seeking to the last line in a 
large file.

I've tried using `Read' with zero based character arrays - + while 
this is much faster, read fills the array completely (ie: if the 
array is [0..999], Read will read 1000 chars from the file) instead 
of stopping at the LF in the file. As each line in the file is 
variable in length, I am unable to allocate a static array. Dynamic 
arrays don't work with `Read', but as I don't the length of each 
string in the file this doesn't really matter.

When comparing speed against what I'm currently doing + using ReadLn 
(ReadLn doesn't read the LF, I was just testing speed), ReadLn is so 
much quicker it's unbelievable.

My question is, does anyone know of a way to read LF terminated lines 
from a file with speed comparable to ReadLn?

Thanks :-)

 
 

 


Reply via email to