// stream from file.
ifstream file;
int main (int argc, char * argv[]) {
// get argument passed from command line
// This is file name
if (argc != 2 ) {
cout << "use: ./executable <filename>";
}else {
//cout << "You are using filename: " << argv[1];
// start the file stream
file (argv[1]);
}
Is there any reason why file(argv[1])
would be giving an error? Can I have a ifstream as a global variable?