Thread: Enum (Access violation) Crash

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    7

    Enum (Access violation) Crash

    Hello All,

    Small console code crashing when it reach to enum (T12::a4) variable. Same thing works fine on GUI.

    error message:

    (First-chance exception at 0x0F3FCAB4 (msvcr100d.dll) in ConsoleApplication2.exe: 0xC0000005: Access violation reading location 0x00000000.
    If there is a handler for this exception, the program may be safely continued.)

    Code:
    funA()
    {
    char one[100] = "7a-11-2";
    char two[100] = "19.32";
    char three[25] = "hello";
    char four[25] = "hello";
    
    m_pVar = new T12::CClassA(two, one, three, four, T12::a4);
    }
    enum.h
    Code:
    namespace T12
    {
    enum em { a1 = 0, a2 = 1, a3 = 2, a4 = 3};
    }
    .h
    Code:
    namespace T12
    {
    CClassA
    {
    public:
    CClassA(const std::string& two, const std::string& one, const  std::string& three, const std::string& four, em eVar);
    };
    
    }
    How to solve this.
    Answers Appreciated.
    Last edited by marvic; 02-11-2017 at 01:11 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 10-19-2010, 09:25 PM
  2. Access Violation
    By beene in forum Game Programming
    Replies: 8
    Last Post: 03-27-2007, 01:39 PM
  3. Access Violation under VC++ 6.0
    By xephyr in forum C Programming
    Replies: 4
    Last Post: 07-30-2004, 12:06 AM
  4. Access violation...
    By major_small in forum C++ Programming
    Replies: 5
    Last Post: 12-18-2003, 12:53 AM
  5. Access Violation!!
    By Yoshi in forum C++ Programming
    Replies: 4
    Last Post: 09-11-2002, 01:22 PM

Tags for this Thread