I am trying to take a a file of fixed size and use seekp to jump to a particular spot in the file, write around 100 bytes or so but only to that part of the file while still keeping the size of the total file the same and not losing the other data. As of right now it is adjusting the total size of the file to the size of the buffer but I dont want that to happen. Heres what I have so far, any help is appreciated.
int r = 2;
int size = 99;
char * buffer = new char(size);
fstream out;
out.open("C:\\Database\\2.bin", ios::out|ios::binary);
out.seekp((r-1)*100);
out.write(buffer, size+1);
out.close();