Use std :: fstream .
The simplest std :: stream will not work. This will truncate your file (unless you use the std :: ios_base :: app option, but that's not what you want).
std::fstream s(my_file_path); // use option std::ios_base::binary if necessary s.seekp(position_of_data_to_overwrite, std::ios_base::beg); s.write(my_data, size_of_data_to_overwrite);
Zuntzu
source share