首页上一页 1  下一页尾页 6 条记录 1/1页
        C++程序运行问题
                 	
                        发表在C++答疑区
                        2015-12-29                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                                           在《Visual C++从入门到精通》第三版的例6.6即第182页 我把“保存”按钮的单击事件代码修改如下,编译时没出错,但运行时点击“保存”按钮,可以正常弹出“保存”对话框,选好保存路径后点击“保存”时出现 Debug Error错误,但不论点击“中止”、“重试”还是“忽略”按钮都会在相应的路径有保存的文件。修改后的代码如下:
CFileDialog dlg(FALSE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
"All Files(*.TXT)|*.TXT||",AfxGetMainWnd());
CString strPath,strText="";
m_FileText.GetWindowText(strText);
if(dlg.DoModal() == IDOK)
{
char *write=new char[strText.GetLength()];
strPath = dlg.GetPathName();
if(strPath.Right(4) != ".TXT")
strPath += ".TXT";
m_SavePath.SetWindowText(strPath);
CFile file(_T(strPath),CFile::modeCreate|CFile::modeWrite);
strcpy(write,strText);
file.Write(write,strText.GetLength());
delete [] write;
file.Close();
}
请问一下这是什么问题?
                
        	
        
        
    CFileDialog dlg(FALSE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
"All Files(*.TXT)|*.TXT||",AfxGetMainWnd());
CString strPath,strText="";
m_FileText.GetWindowText(strText);
if(dlg.DoModal() == IDOK)
{
char *write=new char[strText.GetLength()];
strPath = dlg.GetPathName();
if(strPath.Right(4) != ".TXT")
strPath += ".TXT";
m_SavePath.SetWindowText(strPath);
CFile file(_T(strPath),CFile::modeCreate|CFile::modeWrite);
strcpy(write,strText);
file.Write(write,strText.GetLength());
delete [] write;
file.Close();
}
请问一下这是什么问题?

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
               			  
                







 
                     
                     
					 
						 
						 
						 
						