My program:
The string "Goblox" contains a filepath to a txt file not created yet. I want the program to create that file so it will be named f.x. Goblox.txt in the path the string contains using ofstream, but I don't know how to tell the program in the "myfile.open" line to create a file using the path contained in the string rather than creating a file "Goblox.c_str()".Code:#include <iostream> #include <string> #include <fstream> using namespace std; int main() { string Goblox = "\"C:\\Program Files\\Machinery\\Goblox.txt\""; ofstream myfile1; myfile1.open (" Goblox.c_str() "); //Obviously, there's something wrong about this line myfile1<< Goblox; myfile1.close(); }
How do I do this?