Thread: XP error messages

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    43

    Question XP error messages

    I have written a program in C which runs correctly and I can see all the correct output in the console window that I would expect. But at the very end when the program should end I get a Microsoft error box "myprogram.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
    The console window then says "*** process returned -1073741818 ***".

    Why is it returning this number? The last line of my main function says
    Code:
    return 0;
    }
    so I would expect it to return 0.

    Any thoughts?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Sounds like stack corruption - you're doing bad things in your program

    gg

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > The console window then says "*** process returned -1073741818 ***".
    The first thing you need to do with such numbers is convert them into hexadecimal.
    For example, that is 0xc0000006.
    Googling around suggests that this is some kind of memory fault.

    My guess would be that you've managed to corrupt the memory through bad use of new/delete, and it's only in the final tidy up code (post main) that the problem is actually noticed. And when it is, the normal exit becomes an exception exit, and you get the popup and weird numbers.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 05-07-2009, 11:31 AM
  2. Trying to Install XP over Vista with SATA HD
    By Shamino in forum Tech Board
    Replies: 2
    Last Post: 12-13-2008, 06:56 PM
  3. Need help with program
    By HAssan in forum C Programming
    Replies: 8
    Last Post: 06-10-2007, 08:05 PM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  5. Windows XP regression over time
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-17-2002, 10:49 AM