I have been struggling trying to find the best method of reading and writing to large files (>26,000 lines). This is what I am trying to do:

Tester application creates a log file (text based) that has test information in it. These files can get rather large, >2mb a piece. Sometimes the application crashes and need to be fixed. I created an external application that reads a couple of files to get the information I need to repair the log file with. No problem there, takes seconds to do. But the only way I have been able to actually fix the files is to open the log file and line by line write the information to a new file, and when a particular line is equal to what I need to fix I write the new line with the fixed information. Some information that I need to change is at the beginning of the file and some is at the end.

My question is this: Is there anyway to do this without having to go line by line. I would rather just change the needed lines in the beginning with the new information and then skip to a position near the end of the file and edit those lines.

I can use either VB 6.0 or VB .Net.

Thanks!