Name: OP !ewz/7gcXdY 2008-05-13 23:46
I am working on a small project, and I need to be able to let the user name there txt file. I have tried many things, none have worked.
Also, I'm not exactly the best C++ programmer, so if you could, please explain your answers with a lot of detail.
But what I want is:
char filename;
cin>>filename;
ifstream inputFile;
inputFile.open(filename, ".txt", ios::in);
Obviously, the last line of code is wrong, but thats what I would like to work. I have tried:
strcat(filename, ".txt");
inputFile.open(filename, ios::in);
And it did not work either.
Also, I'm not exactly the best C++ programmer, so if you could, please explain your answers with a lot of detail.
But what I want is:
char filename;
cin>>filename;
ifstream inputFile;
inputFile.open(filename, ".txt", ios::in);
Obviously, the last line of code is wrong, but thats what I would like to work. I have tried:
strcat(filename, ".txt");
inputFile.open(filename, ios::in);
And it did not work either.