Brad,

>ReadLn will read in the entire file if there are no CR's in it, which
>isn't pretty on large files ;-)
>
>So that's why I'm looking for an alternative way to read the file 1 line
>at a time instead of manipulating it by adding CR's or loading the whole
>file.

Why not write your own version of ReadLn that uses ASCII 10 as the
delimiter? If you do your own, you might as well write it so that it works
on either CRLF, or LF, or LFCR combinations.

To keep it simple, start with ASCII 10 as the break character. The only
thing that makes ReadLn fast compared to Read one character as a
time is that ReadLn uses a good sized buffer. Your version of
ReadLn just reads from the buffer and when you reach the end of the
buffer, you reload the buffer from the file. If you have the Delphi source
for the TextFile routines, you could just make a copy of the source,
change the names that would conflict with the TextFile routines and
compile. You will also want to implement EOF.

Just ask the list if you run into problems in the implementation.

Glenn Lawler
www.incodesystems.com

Reply via email to