Is there any simple way to insert an external text to some place within a text file ?
I mean , suppose I have a file which has the following line
Hello world !
and I want to add, say, "_, _" between 'Hello' and 'world'.
What I used to do is to use fseek(file,n,SEEK_CUR) , in order to go to some place in the file , and use fprintf to print into the file in that place .However, as expected, the text is Hello_, _ld !
Do I have to store the last half of the text in some variable , then add my external text , then add that half again ?
or is there a simple way of inserting the text without editing the original content ?