why in the world isnt this working?!

closed account (LAfSLyTq)
1
2
3
4
5
6
7
8
9
10
11
12
int main(){
	SetConsoleTitle("Save Generator");
	cout<<"Enter the path.\n\n Example:\nC:/Users/USER/Documents/savegames/Profile"<<endl;
	cin>>path;
	mkdir(path);
	ofstream text;
	cout<<"Writing files to the directory given\n\t\tPlease Wait..."<<endl;
	text.open("checkpoint.sav");
	text<<"2,0,0\n0,x,y\n0,0,0";
	text.close();
	return 0;
}


it never saves the file to the directory, it just saves it to wherever the .exe. is located.
That's because you are creating the file in the current path on line 8. You'll need to put the full path there or something if you want to make it somewhere else when you make it.
closed account (LAfSLyTq)
how can i make it do something like this
1
2
3
string c2 = "checkpoint.sav";

text.open(path, c2);

????
If path and c2 are proper C++ strings,
text.open((path + c2).c_str());

or on an up-to-date compiler,


text.open(path + c2);
Last edited on
closed account (LAfSLyTq)
thanks bro
Topic archived. No new replies allowed.