I am looking to remove certain sections (ranges of bytes) from files. I used fseek/fwrite/fread to essentially "compact" the data by overwriting the data I was removing with what came after it. After this procedure, there is data on the end of the file which doesn't belong. I need to somehow "truncate" my file at a certain point. I heard you could write EOF to the file and the OS would handle discarding the stuff after, thus giving the desired effect. I actually need the file to shrink by the amount of bytes I desired to remove. However, I haven't found any way to do this with the C or C++ libraries. Anyone able to help me?