i am trying to read a file which already exist in my system as (proj1_test1.txt) but when i rum my code it didn't print the file. This is the code that i got so far. It is compiling but didn't printing the file and when i enter a wrong file name still its not printing the error message. Any help will be appreciated.
char printFile(){
ifstream file;
file.open("proj1_test1.txt");
string a = " ";
cout << " What is the name of file to import?" << endl;
cin >> a;
if (!file){// == a){
cout << "File" << a << " not opened" << endl;
}