I really can't figure out what they are trying to do in this bit of code. It's from one of the tutorials, but it won't compile on my comp.
Code:
#include <iostream>
#include <fstream>
#include <cstdlib>
int main ( int argc, char *argv[] )
{
if ( argc != 3 ) {
std::cerr<<"Usage: %s <readfile1> <writefile2>\n";
std::exit ( EXIT_FAILURE );
}
std::ifstream in ( argv[1] );
if ( !in.is_open() ) {
std::cerr<<"Error opening input file\n";
std::exit ( EXIT_FAILURE );
}
std::ofstream out ( argv[2] );
if ( !out.is_open() ) {
std::cerr<<"Error opening output file\n";
std::exit ( EXIT_FAILURE );
}
char ch;
while ( in.get ( ch ) )
out.put ( ch );
}