Open the file, use fseek to jump to the place you need and write the data, then close the file.
from http://www.cplusplus.com/reference/clibrary/cstdio/fseek/…
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ( "example.txt" , "r+" );
fputs ( "This is an apple." , pFile );
fseek ( pFile , 9 , SEEK_SET );
fputs ( " sam" , pFile );
fclose ( pFile );
return 0;
}
3
solved Is modifying a file without writing a new file possible in c++? [duplicate]