Quote:
Originally Posted by kruptof
did you make sure that you have double slashes (escape) instead of an single slash:
for example if the user enters "c:\myfile.ext" you need to convert that to "c:\\myfile.ext".
|
The code I have obtained so far did not seem to need to type in the file location.
one piece of code I found that didn't work:
//global
#include <string>
FILE* myFile;
string sname;
//in function
cin >> sname;
myFile = fopen(sname.c_str, "w+b");
When I hard code this though, it works:
myFile = fopen("data.txt", "w+b"); It saves the file in the same directory as the project starts from.