[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Access violations...what? How to fix.

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
wills1300
Asked:
wills1300
  • 4
1 Solution
 
nietodCommented:
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
 
nietodCommented:
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
 
wills1300Author Commented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
nietodCommented:
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
 
nietodCommented:
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
 
dpt081598Commented:
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.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now