473,769 Members | 5,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

22 New Member
Hi All,

Plz help me if you can.....

I have a program something like this
int main(int argc,char* argv[])
{
try
{
int* p = NULL;
int i = *p;
}
catch(int* ptr)
{
cout<<"Caught Null pointer Exception\n";
}
catch(...)
{
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 13105
Emrah KAYA
1 New Member
I am using the method described here: http://www.codeproject.com/KB/cpp/exceptionlogging.aspx
Aug 16 '10 #2

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

Similar topics

1
4344
by: jennifer johnson | last post by:
Hello All, I appreciate anyone's assistance. I wanted to validate user customizable field values so I changed my JSP page so that the form action would post existing form - action=<%= getRequestURI() %>. Upon form loading after submit verify field values and if any are left empty a message would be posted, and again form would be reposted until all field values were confirmed not to be empty. If field values were not left blank then it...
1
7320
by: Mark | last post by:
Hi, I'm writing user controls with custom events. I have a parent custom event that exposes some abstract methods and some custom events. I have also created some new user controls that derive from the parent custom control and add some text boxes, labels, buttons etc...
5
2851
by: Tony Cheng | last post by:
for (int i=0; i<_request.Form.Count; i++ ) { string key = _request.Form.GetKey(i); if ( !key.Equals("formCode") && !key.Equals("formLanguage") && !key.Equals("__VIEWSTATE") && !key.Equals("__EVENTARGUMENT") && !key.Equals("__EVENTTARGET") && key.IndexOf("sendButton")<0 && key.IndexOf("clearButton")<0
3
6814
by: chramprasad | last post by:
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { MissionForm missionForm = (MissionForm) form; String strMissionId = InsEncr.getSingleton().decrypt(missionForm.getMissionId().toString()); Long userEntityTypeId = getUserEntityTypeId(request); String strUserEntityTypeId =...
1
3498
by: MRamaLakshmi | last post by:
hi, I am developing an application using Java Applet which will be uploading files. Its throwing Null Pointer exception while detecting the proxy when we are trying to load the applet using Java6. It is working fine for Java5. Here i am giving the piece of code where it is throwing me exception protected void autoDetectProxy(URL url) { // Trying Java system variables.
1
1097
by: bansalrichaacc | last post by:
In The Following Code I am Getting Null Pointer Exception try{ ClientBean clientInfo = clientManager.getClientList(); System.out.println("richa2"+clientInfo); if (clientInfo != null ) { form.setClientInfo(clientInfo); // form.getClientInfo();
11
7082
by: ajos | last post by:
hi friends, seems as if though this null pointers wont let me go peacefully home!!!! i have a jsp page where i do a get attribute like this---> <%String s24=(String) request.getAttribute("s24"); %> and to retrieve the value i do some thing like this---> <%=s24.substring(0,9) %> but the method substring(0,9) is giving me a null pointer exception. have can i avoid or rather eliminate this exception/error?? please guide me regarding this:)....
5
2348
by: iamdennisthomas | last post by:
Hi Guys i was developing a action servlet which is actulally getting the data from a form and putting it in the db but while executing i am getting a null pointer exception /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.radesan.struts.action; import java.sql.*; import javax.servlet.http.HttpServletRequest;
1
1488
by: ramyasakthi | last post by:
how to catch the appropriate null pointer exception for preparestatement while insert to oracle db
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.