I got this exception in my program:
Unhandled exception at 0x0051cce0 in JSONDataParsing.exe: 0xC0000005: Access violation reading location 0x00000004
.
I tried catching the Exception, but of no use. I know where the problem occurs. But wanted to know how I can trap the exception. I used try, catch block around the code where exception occurs.
Is this an exception which can not be caught?
The catch statements are:
catch (bad_alloc&)
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"bad_alloc \n");
OutputDebugString(msgbuf);
}
catch (bad_cast&)
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"bad_cast \n");
OutputDebugString(msgbuf);
}
catch (bad_exception&)
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"babad_exceptiond_alloc \n");
OutputDebugString(msgbuf);
}
catch (bad_typeid&)
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"bad_alloc \n");
OutputDebugString(msgbuf);
}
catch( CMemoryException* e )
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"CMemoryException \n");
OutputDebugString(msgbuf);
// Handle the out-of-memory exception here.
}
catch( CFileException* e )
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"CFileException \n");
OutputDebugString(msgbuf);
// Handle the file exceptions here.
}
catch( CException* e )
{
TCHAR msgbuf[MAX_PATH];
swprintf(msgbuf, L"CException \n");
OutputDebugString(msgbuf);
// Handle the exception here.
// "e" contains information about the exception.
e->Delete();
}