Solved

Access violations...what? How to fix.

Posted on 1998-10-15
6
223 Views
Last Modified: 2010-04-02
Using...MS VC++ 5.0.  Batch programs that calls 2 c++ programs. The first call works fine, but the second gives an "access violation" error. What is this and what do I have to do to fix this?
0
Comment
Question by:wills1300
  • 4
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 70 total points
ID: 1175274
An access violation us ussually when a program attempts to access memory that it doesn't have permission to access.  This us ussaly caused by the program mistakely using a invalid pointer.  Thus it is attempting to access memory that it is allowed to, but because the pointer contains an invalid address, it is actually accessing memory that it is not allowed to.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175275
Look over the code and look for places where it uses pointers and try to debug them.
Another common cause are strings that are not properly terminated.  A non-terminated string appears to go on for ever, thus it will appear to continue into memory that your porgram doesn't have access for.   So look for cases where you attempt to assemble strings and make sure you are terminating them.

Let me know if you have questions.
0
 

Author Comment

by:wills1300
ID: 1175276
I debugged the program, it then gives me this message:
1. c:\windows\systems\kernel32.dll, no matching symbolic  
   information found.
2. The thread 0xFFFC1327 has exited with code 1. (0x1).

Does this mean anything to you? What is #2 with 'thread 0xFFFC1327'? I use many pointers, how can I get to the 'bad' pointer.

thanks for you help.
0
Independent Software Vendors: 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!

 
LVL 22

Expert Comment

by:nietod
ID: 1175277
first of all, make sure you are generating a debug version of your code.  Then make sure VC is running and you have just in time debugging enabled.  When the violation occurs, the debug should show you the line of code that caused the problem.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175278
If that doesn't work, you may have to try to narrow in on the section of your progrm that is casuign the problem.  make it print out messages so that you can determine at what point it is dying.
0
 

Expert Comment

by:dpt081598
ID: 1175279
I get this sort of error once in a while and it is usually because I'm trying to do something with a control in a dialog box and the dialog box either hasn't been constructed yet or has been closed.  For example:

CMyDialogBox dlg;
dlg.m_member_variable = "foobar";  // setting a value is OK
if (dlg.DoModal() == IDOK)
     dlg.m_edit_control.SetFocus(); // error!

Even within CMyDialogBox I may sometimes try to do things with controls in PreCreateWindow that cause an error because the actual dialog box window isn't shown yet.

Experts--does this sound right?





0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

726 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