I would like to know if there is any way that the user could enter a filename and have my program open the file.The thing is all of the files already exist and i want my prog to search for the file and then open it.
I was thinking maybe something like this:
But im not sure this will work because of the:Code:case 1:
{
cout<<"enter filename:";
getline(cin,filename);
ofstream a_file("Ingrediants\\"<<filename<<".txt";
a_file>> information;
a_file.close();
cout<<information;
}
part of the file.Code:ofstream a_file("Ingrediants\\"<<filename<<".txt";