Allocate discent size buffer and call FileRead in a loop. For each read,
scan buffer for end of line chracters and count them.
I am not sure what size of the buffer would be most effective these days.
You may play with it , try 1024,2048, 10240, 65536 etc.
Alex
----- Original Message -----
From: "Sergei Stenkov" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, 20 March 2001 15:11
Subject: RE: [DUG]: Number of lines in text file
> Max Nilson wrote:
>
> > this works nicely for high speed data importing. Biggest file I have
> > tested with was 10MB worth of stock item data, and that only
> > took about
> > three and four seconds to walk.
>
> I too believe that memory access is the fastest way, but the problem is
that
> i have to run files of up to 1GB with a norm of about 100Mb. Shurely that
> would drain the memory in no time?
> I split those files into smaller and more digestible ones, but for that I
> have to read the number of lines from the original file at least once to
> determine the number of threads to run.
>
> I've tried memory tables of similar size before and they couldn't handle
it.
>
> Best regards,
> Sergei
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"