This works:
file.open("Levels\\test.txt");
This doesn’t:
string pathname = "Levels\\test.txt";
file.open(pathname);
It outputs the following error:
no matching function for call to 'std::basic_ifstrea<char, std::char_traits<char> >::open
(std::string&)'
That member function takes a
char const*, not astd::string; you would need to pass itpathname.c_str().(In C++0x, there is an overload of
openthat takes astd::string, so your code will someday work as is; your implementation apparently does not support this yet.)