iostream path

Hi,

I am getting an error on the last line posted here. I have printed the string and it works as i want it too, but using it as the path for the iostream is not working.

1
2
3
4
5
6
	string folder;
	cout << "Enter folder name: ";
        cin >> folder;
	string path = "saves\\" + folder + "\\players.ehm";
	ifstream PlayersFile;
	PlayersFile.open(path);


Thanks for any help,
-Jason
Last edited on
file streams get C strings as arguments. You can fix this by calling std::string::c_str()
PlayersFile.open(path.c_str());
Topic archived. No new replies allowed.