I have a text file (Actually a .BFR file that I just renamed to .txt) that I need to update values in. I already created my C++ program that will open that file, search the file for whatever value I want to replace. And what lines those values occur on.
However, I can't seem to figure out how to actually replace those numbers with another one.
That talks about finding and replacing a line though. My numbers are within a line. How would I find the position of them within the line to replace them.
So basically I have about 500 numbers like that in sequence. And I want this program to search for 32190, increment it by 300, replace the 32190 with 32490.
You can read the whole line and then use string manipulation to replace whatever you want. I think reading and writing a single text line from a file is nothing for now-a-days' computers, right?
I'm still super confused on how to replace that number, and then write to the same file? Is that possible? Or do I have to delete that file, and then write a new one with the same name?