I want to replace dates in a line in a .txt file.
The line might look like this:
1234 24.08 24.09.
Can I find this line by just searching for 1234
and replace the dates 24.08
and 24.09
?
I want to replace dates in a line in a .txt file.
The line might look like this:
1234 24.08 24.09.
Can I find this line by just searching for 1234
and replace the dates 24.08
and 24.09
?
If your replacement has the same quantity of characters as the text in the file, then go ahead and seek to the position and overwrite the text (see std::ostream::seekp).
Otherwise, you will have to write to a new file.
Files can't expand in the middle.