How would you go about giving the user the ability to change the Name of the ofstream File using c++ MFC. I would like to add an Edit Control Box that will give the user an ability to Type in the File Name before clicking save. This is my current code, any feedback will be greatly appreciated.
void CECET_MFC_Dialog_Based_IntroDlg::OnBnClickedSave()
{
UpdateData(true);
ofstream myfile ("Save_Random.xls");
if (myfile.is_open())
{
myfile << "This is the 1st line.\n" << endl;
for(int index=0; index<100; index++){ // samples to create
myfile << setprecision(4) << dblArray[index] << endl;
}
myfile << "This is another line.\n";
myfile << "Max = " << rndMax << endl;
myfile << "Min = " << rndMin << endl;
myfile << "Mean = " << Final_Avg << endl;
myfile.close();
}
else cout << "Unable to open file";
UpdateData(false);
}