ifstream
constructor takes filename as a const char *
rather than a C++ string
. See this. The c_str()
member function returns a const char *
pointer to the string.
edit: Maybe your compiler supports an overloaded version of this constructor or the standard got updated.