Solved

Access violations...what? How to fix.

Posted on 1998-10-15
6
212 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

776 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