#include #include #include int main (int argc, char *argv[]) { // check for the right number of arguments if (argc != 3){ cerr << "Usage: huffman infile_name outfile_name" << endl; exit (-1); } // open the input file and check status ifstream inFile( argv[1], ios::in ); if ( !inFile) { // open failed cerr << "Cannot open " << argv[1] << " for input \n" << endl; exit (-1); } // open the output file and check status ofstream outFile( argv[2], ios::out ); if ( !outFile) { // open failed cerr << "Cannot open " << argv[2] << " for output \n" << endl; exit (-1); } // process the file // this example just copies the input file // to the output file // Of course, you'll replace this char ch; while ( inFile.get (ch) ) outFile.put (ch ); return 0; }