Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I'm writing a primitive file compression program; basically the general idea is it reads an inputted file, does some computations and writes a compressed version back to another file, the compressed file. Im using the fstream.h header and the read and write functions.
My textfiles work fine, but various other types of files stop working at certain places. For example in one file it's the 6th byte which happens to be a number 6. The loops and computations still run in the "background" but the variable that im storing in stops getting updated.
I was wondering if there is some weird things that happen when doing binary file i/o specifically that you need to watch out for, like certain bytes can't be read or something like that. I can't think of anything else it could be because it works with the textfiles I've tried.