Aug-10-2020, 06:59 AM
You can't really do it "in place" unless you never change the length of a line. Otherwise, you have to change the position of every character later in the file.
Instead, open a third file for writing. Conditionally copy every line in the file you want to change into the third file so it's correct. When you're done, rename the file to replace the original one.
Instead, open a third file for writing. Conditionally copy every line in the file you want to change into the third file so it's correct. When you're done, rename the file to replace the original one.