471,873 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

How to catch and log NULL pointer exception in C++

Hi All,

Plz help me if you can.....

I have a program something like this
int main(int argc,char* argv[])
int* p = NULL;
int i = *p;
catch(int* ptr)
cout<<"Caught Null pointer Exception\n";
cout<<"Caught an Exception\n";
return 0;
Result of this program is
"Caught an Exception"
But i was expecting "Caught Null pointer Exception"

Now plz tell me how to know in which line exception occured and which exception occured

Eagerly waithig for your reply..........
Sep 10 '06 #1
1 12884
I am using the method described here: http://www.codeproject.com/KB/cpp/exceptionlogging.aspx
Aug 16 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Tony Cheng | last post: by
3 posts views Thread by chramprasad | last post: by
1 post views Thread by bansalrichaacc | last post: by
5 posts views Thread by iamdennisthomas | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.