Please tell me why this is failing to open the files:
Code:
string trainingFile;
string testingFile;
cout << "Please specify the file you would like to use for TRAINING: " << endl;
cin >> trainingFile;
cout <<"Please specify the file you would like to use for TESTING: " << endl;
cin >> testingFile;
ifstream file; // input file stream
file.open(trainingFile.c_str()); // c_str() converts file name into a form open() can handle
if(file.fail())
{
cerr << "Input file 'training' problem!" << endl;
return 1;
}
ifstream test_file;
test_file.open(testingFile.c_str());
if(test_file.fail())
{
cerr << "Input file 'testing' problem!" << endl;
return 1;
}