Let's say that I've opened a binary file for reading using fstream. Is it possible for me to delete portions of the file as it is being read (i.e. remove all of the bytes from byte x to y), while keeping fstream open? If so, how can this be achieved?
If you mean moving bytes in the file itself around, it's possible, but it's so slow and the code required is so cumbersome that it's not recommendable.
It's far easier to just read the file to memory, do the changes, then write back.