CString FilePathName;
CFileDialog dlg(FALSE,//for save as
        "*.txt",//
        "SimulationResult.txt", //defalut filename
        OFN_CREATEPROMPT|OFN_OVERWRITEPROMPT ,//
        "XLS Files (*.txt)|*.txt||",
        AfxGetMainWnd() );///TRUE为OPEN对话框,FALSE为SAVE AS对话框
if(dlg.DoModal()==IDOK)
{
FilePathName=  dlg.GetPathName();

Prompt("正在保存模拟文件! ");
                           CFile myFile;
                           myFile.Open(FilePathName, CFile::modeCreate)
                    }
如上所示,先用文件对话框建立一个新文件,让后再对这个新文件进行读写,myFile.Open()必须是直接指定文件名吗?