crashing problem in c++

This is a discussion on crashing problem in c++ within the C++ Programming forums, part of the General Programming Boards category; I've been getting a strange problem with a program i'm working on. i'm making a small, dos-based trivia game for ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    4

    Question crashing problem in c++

    I've been getting a strange problem with a program i'm working on. i'm making a small, dos-based trivia game for a class. the problem i'm having is that, even though the compiler i'm using (bloodshed.net's dev-cpp 4) says there's no errors and compiles fine, whenever i try to run the program it crashes instantly. i've gone through all the files and i've narrowed it down to one. I've been using a 3d array of strings (the class, not char arrays) to store the category names, questions, and answers. i have the array stored in a .hpp file which i include into the main file. this file seems to be causing the problem but i can't figure out how. i've talked to everyone i know that can program and they can't figure it out either. i was hoping that some of you all might be willing to take a look at my code and tell me what the problem is. it's too long to post on here so if you're willing to take a look then please reply here or email me at hideon9 AT yahoo DOT com or im me on yahoo messenger (hideon9). i would really appreciate any help on this, i have to have it done by tomorrow and i'm totally lost. thanks.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Just post the suspected file here as an attachment. Someone will probably help you...
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    4
    the file i'm having the problem with is attached.
    Attached Files Attached Files

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    What's the crash error?

    You might wanna try initializing all of them as separate declarations instead of using the brackets and ,'s.

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    4
    i tried it without brackets and commas and when i tried to compile it ended up with 31 new errors.

    error that shows when i try to run the game is "This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor."

    dunno if this will help but just in case, here are the details:

    MAIN caused an invalid page fault in
    module MAIN.EXE at 0167:00418904.
    Registers:
    EAX=fffffff0 CS=0167 EIP=00418904 EFLGS=00010202
    EBX=0041b000 SS=016f ESP=0254f108 EBP=0254f120
    ECX=fffffff0 DS=016f ESI=0041b000 FS=3a0f
    EDX=0041b000 ES=016f EDI=0000000f GS=0000
    Bytes at CS:EIP:
    8b 10 89 d0 eb 04 eb 02 eb 00 8b 5d e8 c9 c3 00
    Stack dump:
    0041b000 00000000 00000000 00000000 00000000 00000000 0254f160 00418cd9 0041b000 00000000 00000000 00000000 0041b000 00401a78 0000000f 00000000

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    A 3d array of stl::strings - are you sure about that??
    How are you accessing the variables?
    BTW: I noticed that all of your
    array[X][0][1] cells are unused...deliberate?
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    4
    is there a problem making an array of strings? i thought you could use the string class by #including <string> and that you could make an array of any type? i'm new to strings so maybe i'm unaware of some problem in this?

    accessing the variable just like any other array. like to get the answer to the third question in the first category i would access array[0][3][1]. i'm checking the answers against input but everything else just gets printed to the screen.

    the array[x][0][1] cells are empty because i don't really have anything to put in there the way i have the array set up now. they were used in the way i did have it set up but i had to change it. probably gonna rewrite it eventually but i wanted to find out how it was crashing the program without the compiler finding any bugs.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BAD problem: wlg functions crashing my computer!
    By Yarin in forum Windows Programming
    Replies: 0
    Last Post: 04-02-2008, 10:30 AM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21