can i get some help please?

so i am creating a program where you enter some info and it creates a document with the info on it BUT i was wondering if anyone could tell me how to save the file in a location i want here is the code:

#include <stdafx.h>
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

string email;
string name;

int main()
{
cout <<"Please enter your E-mail" << endl;
cin >>email;
cout <<"Please enter your name" << endl;
cin >>name;

int idata=23;
float fdata=3.14159f;
ofstream myfile;
myfile.open ("DataBase.txt");
myfile << "E-mail:" <<email<<"" << endl;
myfile << "Name:" <<name<<"" << endl;
myfile.close();
return 0;
}


Thank You!
1
2
3
4
  string filename;
  cout << "Where do you want to save your file? ";
  cin >> filename;
  myfile.open (filename.c_str());


PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.