I\'ve got a fstream my_file(\"test.txt\"), but I don\'t know if test.txt exists. In case it exists, I would like to know if I can read it, too. How to do that?
I
Since C++11 it's possible to use implicit operator bool instead of good():
good()
ifstream my_file("test.txt"); if (my_file) { // read away }