Jul 13, 2012 at 11:12pm UTC
I have recently made a short app that allows the user to make a short wish list... and retrieved the exe file, but when i run it the file is no where to be found here is my code, i have included fstream, for reference
int makeFile()
{
ofstream myFile;
myFile.open("WishList.txt");
myFile <<varTitle<<":"<<endl;
myFile <<" "<<endl;
myFile <<" "<<endl;
myFile <<" "<<endl;
myFile <<"1.)"<<item1<<endl;
myFile <<"2.)"<<item2<<endl;
myFile <<"3.)"<<item3<<endl;
myFile <<"4.)"<<item4<<endl;
myFile <<"5.)"<<item5<<endl;
myFile <<"6.)"<<item6<<endl;
myFile <<"7.)"<<item7<<endl;
myFile <<"8.)"<<item8<<endl;
myFile <<"9.)"<<item9<<endl;
myFile <<"10.)"<<item10<<endl;
myFile <<"11.)"<<item11<<endl;
myFile <<"12.)"<<item12<<endl;
myFile <<"13.)"<<item13<<endl;
myFile <<"14.)"<<item14<<endl;
myFile <<"15.)"<<item15<<endl;
myFile <<"16.)"<<item16<<endl;
myFile <<"17.)"<<item17<<endl;
myFile <<"18.)"<<item18<<endl;
myFile <<"19.)"<<item19<<endl;
myFile <<"20.)"<<item20<<endl;
myFile <<"21.)"<<item21<<endl;
myFile <<"22.)"<<item22<<endl;
myFile <<"23.)"<<item23<<endl;
myFile <<"24.)"<<item24<<endl;
myFile <<"25.)"<<item25<<endl;
myFile.close();
cout << "Look for your Wishlist called WishList.txt"<<endl;
return 0;
}
is there a way to specify where this saves and if so, how?
Jul 13, 2012 at 11:27pm UTC
The file will be within the same directory as your final build. E.g. C:/.../Project/Bin/Debug/File.txt
Are you running your program from the terminal/command-prompt, or from the IDE?
Wazzak
Jul 13, 2012 at 11:36pm UTC
The file should be within the same folder as the executable.
Wazzak
Jul 13, 2012 at 11:38pm UTC
it was, i found it, but is there a way to change where it will save
Jul 13, 2012 at 11:41pm UTC
You'll have to specify an absolute path. E.g.
file_.open("C:/.../Folder/Folder/" );
Wazzak
Last edited on Jul 13, 2012 at 11:42pm UTC