There is a better and quickly way to read a .txt file, find a Match string ?

A totally different way of dealing with this kind of problem is

  1. Ensure that each to the records in the file has the same length

  2. Sort the file so that the records are in order (do this when the file is created) (say lowest number first)

  3. Open the file for random not sequential access. Your not reading one char at a time but a block at a time from wherever you want.

  4. Now apply a binary chop/search. Basically read the middle record in the file if you went to far read the record 0.25 of the way in, if you did not go far enough read at 0.75 of the file length. The next move is 1/16 and then 1/32 and so on.

  5. read sequentially to get you the last bit of the way.

With 50000 records 10 chops one or two hundred records of your target.

Mark