Is it possible to either see what the next line of a file is or write to the previous line of a file?
I am reading through a roughly 13,000 line file and if a line matches one of my regular expressions I then change the line, if not, it stays the same. These lines are getting written to a new file. It looks like this, roughly of course.
//create Streamreader sr
//create Streamwriter sw
//loop through file by line
//if line matches REGEX, change it. Else, don't change it
//write line to new file
//if end of file, close sr and sw
I need to either look to the next for ENDREC
so I can write a new line before it
OR if the current line is ENDREC
I need to write to the line before it. Any ideas?
How about something like this?