can't do file i/o if path is a variable

1
2
3
4
5
	
	ifstream f;
	string path;
	cin >> path;
	f.open(path)


i keep getting a strange error if the file path comes from a variable.

any idea how to fix this problem?.

thx ahead :)
Last edited on
The path variable needs to be a c style string, so instead of f.open(path) instead do f.open(path.c_str()).
Topic archived. No new replies allowed.