How to make fseek
not overwrite what was at the given position when used with fwrite
?
I am opening a file with
file = fopen(filename, "r+");
and then use
fseek (file, pos, SEEK_SET);
to go to the position I need, using
fwrite(text, 1, text_size, file);
to write the data.
example:
Say, I want to add '7' at position 3:
abcdef
I want this to be
abc7def