Hıı everyone,
ı am new to c++ , ı am trying to reading from a file but ıt does not work can you help me why ı can not read from a file this is my code and ı am using vs2010.
int main()
{ string al;
int a;
ifstream a_file;
a_file.open("pe.txt");
a_file>>al;
cout<<al<<endl;
a_file.close();
cin>>a;
return 0;
}
It's possible that your program cannot find the file. pe.txt must be in the "current directory". That is, the directory that you're currently in when you run the program.