Here is a piece of code that is supposed to overwrite a certain portion of a file:
int bucket;
fstream primary;
char pbucket[505];
.
.
.
primary.open("primary.txt",fstream::ate);
primary.seekp((bucket-1)*505,ios::beg);
primary.write(pbucket,505);
primary.close();
But it does not change the file at all.
What can be the cause? ...
std::fstream::ate sets the file pointer at the end of the file. You don't need that flag.
If I'm not mistaken, the problem is that you're not opening the file for writing.
Try changing the type of primary to std::ofstream and open it with the flag std::ios::binary.