Thread: C++ question
View Single Post
Old Oct 23rd, 2006, 7:39 AM   #9
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 244
Rep Power: 3 Seif is on a distinguished road
Another problem is that you are trying to pass the open() function a string, when in actual fact it takes a character array const char *. So either use a character array to store your file path, or use the c_str() member function of your current string to convert it to a char array.

for example:

string filepath = "C:\\";
string filename = "answers.txt";
string file = filepath + filename;

ofstream myfile2(file.c_str());
Seif is offline   Reply With Quote