#include #include using namespace std; int main() { ifstream in("corrupted.png.bz2", ios::in | ios::binary); ofstream out("clean.png.bz2", ios::out | ios::binary); char p, n; in.read(&p,1); while (in.read(&n,1)) { if (n != '\n' || p != '\r') { out.write(&p,1); } p = n; } out.write(&p,1); }