Ok I got this now it has getline I run it and when I put the file name all it says isCode:#include <iostream> #include <string> #include <fstream> using namespace std; // Function prototypes int main() { string name; cout << "Please enter the filename of the encoded message:"; getline(cin,name); ifstream infile; infile.open(name.c_str()); if (infile.fail()) { cout << name << " fail to open." << endl; exit(1); } cout << " File successfully opened" << endl; infile.close(); return 0; }
"File successfully opened". BUT the file DOESN'T OPEN!!!!
ugh!!1