Hey guys I am using code that does the following:
The problem is that if a file name is entered that does not exist for example c:\\fred.txt the error message will not appear and the txt file fread will be created. Any ideas what I have done wrong?Code:
cin.ignore();
cin.getline(file, 250);
ifstream test;
test.open (file);
if (test.fail())
{
cout<<"error"<<endl;
exit(1);
}
...
Thanks.