I have a text file. Each line begins with a date like "19970515".
There might be up to a few hundred dates in this text file, possibly
in random order, but I cannot be sure
someone might not put thousands of lines in there.
I am avoiding a database with an index, because
that way users cannot edit the text file with Notepad.exe or other
19970514 This is a record
19970521 This is more info
19961212 This is some data
19980202 This is another record
19950608 This is yet more info
I am looking for a clever way to sort this file in the most efficient
manner. Each line is less than 255 characters.
So I am thinking:
Using Delphi 16-bit, I wonder, what are the limits to the number of
strings? If the limit is 64K, and 200 bytes per
line, then 5 records per K, 60*5 +4*5 = 300+20= 320 records
max. That would not be enough.
I seem to remember some old-fashioned sort algorithm. Two files would
run against each other with some sort of buffer where records are
compared, but don't recall how this is done without scanning and
re-reading the entire
file countless numbers of times.
Email me. I reply to every email.