void CexceptionDlg::OnBnClickedOk()
{
CString str="hello world";
TRY {
CFile file("c:\\hello.txt",CFile::modeCreate| CFile::modeWrite);
file.Write(str,str.GetLength());
file.Close();
} CATCH(CFileException,e)
{
switch(e->m_cause)
{
case CFileException::accessDenied :
AfxMessageBox("file accessDenied");
break;
case CFileException::fileNotFound:
AfxMessageBox("file not found");
break;
}
} OnOK();
}
出错提示:
C:\Program Files\Microsoft Visual Studio\MyProjects\aaa\aaaDlg.cpp(195) : fatal error C1004: unexpected end of file found
百思不得其解
{
CString str="hello world";
TRY {
CFile file("c:\\hello.txt",CFile::modeCreate| CFile::modeWrite);
file.Write(str,str.GetLength());
file.Close();
} CATCH(CFileException,e)
{
switch(e->m_cause)
{
case CFileException::accessDenied :
AfxMessageBox("file accessDenied");
break;
case CFileException::fileNotFound:
AfxMessageBox("file not found");
break;
}
} OnOK();
}
出错提示:
C:\Program Files\Microsoft Visual Studio\MyProjects\aaa\aaaDlg.cpp(195) : fatal error C1004: unexpected end of file found
百思不得其解
解决方案 »
- 怎么自画ListCtrl的非item部分呢?
- 这个问题困扰了我2个月了, 再不解决就要抄鱿鱼了, 大家帮帮忙呀
- 有谁用过MS CryptoAPI 进行MD5加解密
- OnTimer 执行不到的问题
- 怎样odbc连接mysqld,用CDBVariant取出mediumblob字段的内容?
- 在Windows CE上用EVC3.0声音处理???
- 一个智力题
- 请教关于MSFlexGrid控件
- 急!如何使form区域完全显示我所画的图!!(有程序)
- 驱动高手请留意!
- 请教关于动态划分窗体及浮动窗体的制作问题
- 二维数组名作为参数传给char** pcOutStr,然后在函数中为什么不能strcpy(pcOutStr,"abc",2)
{
switch(e->m_cause)
{
case CFileException::accessDenied :
AfxMessageBox("file accessDenied");
break;
case CFileException::fileNotFound:
AfxMessageBox("file not found");
break;
}
加一句试市 file.Close();
}
END_CATCHCATCH(CFileException,e)
{
switch(e->m_cause)
{
case CFileException::accessDenied :
AfxMessageBox("file accessDenied");
break;
case CFileException::fileNotFound:
AfxMessageBox("file not found");
break;
}
}END_CATCH