All pastes #1323224 Raw Edit

Stuff

public text v1 · immutable
#1323224 ·published 2009-01-31 00:27 UTC
rendered paste body
#include <iostream>
#include <fstream>
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);
}