Code:
infile.open(input)
if(!infile)
{
cout<<"Invalid file name. Try again."<<endl;
}
Here, I am trying to read the file designated by "input".
Infile is an instance of the ifstream class.
When I enter a valid filename, everything works fine, but if I enter an invalid file name, the program reprompts to enter a filename, and all subsequent attempts fail to open the file, even if the input is cleared and the file name is correct. I know for SURE that the problem is in this section of code; I do not know how to remedy it though.