Is it because of I'm using a string? Otherwise I am at a loss.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main() {
string filename;
cout << "Enter the name of the data file to open with the extension" << endl;
getline(cin,filename);
ifstream input_file(filename.c_str());
if (!input_file) { //if file is not open
cout << "not open";
}
else {
cout << "open";
}