using variables as ofstream save locations

Is it possible to have someone, say, input a value to a string variable "justastringvar" and later use it in an ofstream like
ofstream ofstring(justastringvar);?
Yes.
1
2
3
std::string s;
//...
std::fstream(s.c_str());
Topic archived. No new replies allowed.