Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access violations...what? How to fix.

Posted on 1998-10-15
6
Medium Priority
?
242 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
[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
  • 4
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 280 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Hire Technology Freelancers with Gigs

Work with 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

636 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