|
-
November 5th, 2013, 04:02 PM
#1
could not save file using cfiledialog Saveas in MFC
Hi everyone,
I am trying to develop a GUI using MFC, but I am having trouble using CFiledialog to save a file. The problem is, the file is not getting saved to the folder when I use the CFiledialog. Below is the code I am using.
Code:
CString szFilter = "XNRep Files (*.xnrep)|*.xnrep||";
CString s = "xnrep";
CString t = "";
CFileDialog fileDlg(FALSE, s, t, NULL, szFilter);
if(fileDlg.DoModal() == IDOK)
{
std::ofstream file;
file.open(fileDlg.GetFileName(),std::ios::out);
if (file != NULL)
{
file << (*assembly);
file.close();
}
}
After the file dialog opens up, I enter the name of the file and select OK button. But the file does not show up in the directory I am saving to. Any suggestions would be appreciated. Thanks.
Last edited by ovidiucucu; November 12th, 2013 at 07:22 AM.
Reason: added CODE tags
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|