Re:Opening very large text files
Yup - DoDi is right.
What I do is read the file in large chunks using a TStream, as I
encounter CrLf I record the position and string length in a temporary
'index' file
[Position] [Length]
This gives random read access to any line in the file
Depending on your application you may want to process the whole file
in one go, or just process say 1 large block at a time.
A text viewer is better processing the lot (even if it is spoofed with
a Thread or on a Timer) if you only want sequential access then just
pull it off a buffer as needed - and refill the buffer when required.
The trick is to minimize the number of Disk Accesses.
On 21 Oct 2000 00:51:47 GMT, vb...@aol.com (VBDis) wrote:
Quote
>Im Artikel <39EE3DE4.8F70D...@actfs.com.au>, Allan Morris
><allan.mor...@actfs.com.au> schreibt:
>>Is there anyway that I can read this text file ?
>Use TStream instead of the legacy File interface. I'm currently working with an
>68 MB file and a TFileStream, without any problems.
>Of course you should avoid to read the whole file into memory, unless you have
>an appropriate amount of free RAM available. Otherwise the chunks read from the
>file are swapped out to disk almost immediately, and the swapping mechanism of
>Windows results in a much slower processing, as if you were reading only the
>actually interesting line from the file.
>DoDi