View Single Post
Old Jan 10th, 2007, 12:34 PM   #3
JustAnotherGuy
Newbie
 
Join Date: Jan 2007
Posts: 4
Rep Power: 0 JustAnotherGuy is on a distinguished road
Quote:
Originally Posted by kruptof View Post
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.
JustAnotherGuy is offline   Reply With Quote