Tuesday, March 22, 2011

Handling any type of exception...

Normally NULL pointer exception can not be handled by normal try..catch..

For that we need to use structured exception handling...

__try
{
int k = 6;
int g = add(3,7);
//int y = sum(3);
// struct A *a=NULL;

int j = fun(NULL);
int u = 0;
}
__except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION )
{
AfxMessageBox(L"senthil");
return;

}
}