1) I'm asking use to enter a file name. How do I write an error checking if/else statement that checks if the file name exists withing the folder?
Like lets say the file is name file.txt. If the user enters an invalid file such as fil.txt I want the program to exit
1 2 3 4
cout << "Please enter the name of the file that needs to be encrypted using the rot method:"<<endl;
cin >> fileName;
ifstream fin;
fin.open(fileName.data());
This will of course only indicate whether the file is open, a file may not have been able to be opened for more reasons than not existing, but this is close enough. You could also use boost to do it, which can tell you more correctly if the file exists or not, though I think mainly your concern will be whether you can open it or not (why would you want to handle the case that it exists but can't be opened, for example?)