Reputation: 31
In C, I'm using fseek
to go back to a position in the file. When I then write to the file with fprintf
, it overwrites the characters at that location. Is there a way to make fprintf/another function insert, instead of overwrite?
Thanks
Upvotes: 1
Views: 1118
Reputation: 360592
No. C has no concept of "file insertion". You'll have to manually create a 'gap' in the file by copying all the data that comes AFTER your insertion point to a spot farther down the file.
Upvotes: 0
Reputation: 54551
The short answer is "no". If you need to insert, you really need to rewrite the entire file after the insertion.
Upvotes: 5