Because a file is already saved, you cant actually remove part of it.
What you can do is programmatically copy the file and leave out the bit you want to remove, resulting in a shorter file. This involves reading the file into your C++ program and then saving the bits you want to save.
if you can hold the entire file in memory you could resave to the original filename, otherwise you will need to save to a new temporary file, then delete the old file and rename the new one.