I'm trying to dynamically specify a filename to be equal to something the user specifies at an earlier point in the system. The code I have is...
...where file is a string variable. However I get an error saying it cannot convert std::string to const char *. Is there any way to use a C++ string to specify a file name or if that isn't possible how can I convert it to a C string?Code:ofstream out; out.open(file, ios::out|ios::app);