How can I cut the unnecesary space left at the end of the file with fstream? I've got a binary file ~250mb big and after certain operations I'm left with ~100mb of data left in file (at the beginning). The file however is still 250mb. How can I free up the disk space?
It's a lot of identical structs written to the file sequentially using:
fstream::write((char *)data_struct,sizeof(data_struct));
Sometimes the structs at the end of the file are no longer needed.