I had code that looked like this:
std::vector <std::string> info;
info.push_back("10");
info.push_back("this is a line to print");
std::ofstream myfile;
myfile.open("list.txt");
myfile<<"first*"<<info[0]<<"\n";
which worked fine but when, it creates the file and prints the information, but when I changed it to this:
std::vector <std::string> info;
info.push_back("10");
info.push_back("this is a line to print");
std::ofstream myfile;
myfile.open("Output\\list.txt");
myfile<<"first*"<<info[0]<<"\n";
it creates the file but the instant I try to output to the file the whole thing crashes. I am using code::blocks with a GNU gcc compiler on windows 8.
provide the absolute path as "C:\Documents\yourprojects\yourcurrentproject\Output\list.txt". and it will work fine. i tried it.