#include <iostream>
#include <fstream>
int main( int argc, char *argv[] )
{
if ( argc != 2 ) {
cout << "Usage: my_program filename" << endl;
return 0;
}
ifstream inFile( argv[1] );
if ( !inFile ) {
cerr << argv[1] << "could not be opened" << endl;
return -1;
}
// and so on...
Consult any book on C++ (or C), for instance Deitel and Deitel, C++ How to Program, for more details.