Solved

Visual C++ Access violation reading location 0x00000004

Posted on 2010-08-14
3
1,803 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

756 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