Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual C++ Access violation reading location 0x00000004

Posted on 2010-08-14
3
Medium Priority
?
1,884 Views
Last Modified: 2012-05-10
Well...i've converted to bstr 10 different ways and still get this error.

Unhandled exception at 0x00f61ce0 (FEPAdapterWrapperCPP2.dll) in ceraexe0471.exe: 0xC0000005: Access violation reading location 0x00000004.

I’m sure it just has to do with the way I’m referring to a variable…. Here is the code causing the error.

Last line is where the error occurs……. pstrInputClaim is passed into this function as a char[]

                  CComBSTR bstr(pstrInputClaim);
                  BSTR bstrInputClaim = bstr.Copy();    
                  vResult = plDomDocument->loadXML(bstrInputClaim,&bSuccess);

thanks for your continued support : )
0
Comment
Question by:fraeliz8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 1000 total points
ID: 33437762
An example from Microsoft is here:
http://msdn.microsoft.com/en-us/library/dd893387(VS.85).aspx

they simply use CComBSTR.

I think, in your case

CComBSTR bstr(pstrInputClaim);
hr = pXMLDoc->loadXML(bstr, & bSuccess);

will work.

I didn't forget about CoInitialize
0
 

Author Comment

by:fraeliz8
ID: 33437954
Thanks.... turns out the bstr conversion was not the problem..but that example you provided from MSDN helped my find the problem...it was with the pXMLDoc....not being valid.... all is good for now..thanks so much.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33437985
You are welcome. I'm glad to help.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question