c++ 错误处理

#include <iostream>
#include <afxwin.h>

int main()
{
	try
	{
		CFile f(_T("c:\\1.txt"), CFile::modeWrite);

	}
	catch (CFileException* e)
	{
		if (e->m_cause==CFileException::fileNotFound)
		{
			AfxMessageBox(_T("File not found"));
		}
	}
}

猜你喜欢

转载自blog.csdn.net/dxm809/article/details/114776324