/* * This program flips all the bits in a file */ #include #include #include using namespace std; int main(int argc, char** argv) { if(argc < 3) { cout << "Flips all the bits in a file" << endl; cout << "Usage: " << argv[0] << " " << endl; return 0; } char n; char k; ifstream infile (argv[1]); ofstream outfile (argv[2]); if(infile.is_open() && outfile.is_open()) { while(!infile.eof()) { infile.get(n); k = n ^ 0xFFFFFFFF; outfile << k; } } else { cout << "Couldn't open input file." << endl; } infile.close(); outfile.close(); return 0; }