Firstly, I want to insert characters into a text file. I want to print the characters (DAD1) into the middle of the text file (HERE with DA D1) and the
The other answers are suggesting loading the entire file into memory, so I thought I would leave a comment:
If memory is an issue, try the following:
Advantages: Can handle a file twice the size of your memory, less copying.
Disadvantage: More iteration