I am trying to read in a previously made file from user input.
I have googled and thumbed through a couple of books and i can see whats wrong. the file is placed in the same location as if i would have made a file from the console. I get cannot open file
Code:char FileName[20]; ifstream infile; cout << "Enter the name of the file you want to open: "; cin >> FileName; infile.open(FileName, ios::in); infile >> FileName; cout << "\file contents: " << FileName; if(!infile) { cout << "cannot open file"; }



LinkBack URL
About LinkBacks



