could not save file using cfiledialog Saveas in MFC
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: could not save file using cfiledialog Saveas in MFC

Threaded View

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center