How to check if a file exist in a directory

Hi, I've got a problem.
User enter a file name, how to check if the file exist or not?
Thanks!
1
2
3
4
5
ifstream my_file("test.txt");
if (my_file.good())
{
  // read away
}


from stackoverflow.net

http://www.cplusplus.com/reference/iostream/ifstream/
Last edited on
I used fopen :) I think it's the easiest way. anw, thanks!
Topic archived. No new replies allowed.