提示assertion failure
BOOL CClassifyDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CRichEditDoc::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
bool bRet = true;//记录返回值
CRichEditView *pView = NULL;
char *pfileContent = NULL;
CFile file;
//读取文件内容;
try
{
file.Open(lpszPathName,CFile::modeRead);
pfileContent = new char[file.GetLength()+1];//动态数组
memset(pfileContent,0,file.GetLength()+1);
file.ReadHuge(pfileContent,file.GetLength());
file.Close();
}
catch (CFileException * e)
{
ASSERT(false);
e->m_cause;
bRet=FALSE ;
goto end;
}
pView =GetView();
if(NULL==pView)
{
bRet=FALSE;
goto end;
}
{
CRichEditCtrl & edit = pView ->GetRichEditCtrl();
edit.SetWindowText(pfileContent);
//设置未修改避免关闭的时候弹出提示保存对话框
SetModifiedFlag (false);
goto end;
}
end:
if (NULL !=pfileContent)
{
delete [] pfileContent;
pfileContent = NULL;
}
return bRet;
}