#include #include #include using namespace std; #define SIZE 512 int main (int argc, char *argv[]) { string filename; cout << "Enter input filename: "; cin >> filename; ifstream infile(filename.c_str()); if (!infile.is_open()) { cout << "[Read] Unable to open " << filename; return -1; } cout << "Enter output filename: "; cin >> filename; ofstream outfile(filename.c_str(), ios::trunc); if (!outfile.is_open()) { cout << "[Write] Unable to open " << filename; return -1; } char buf[SIZE]; while(!infile.eof()) { infile.read(buf, SIZE); outfile.write(buf, infile.gcount()); } infile.close(); outfile.close(); }