Thread: Terminating a program

  1. #1
    Registered User
    Join Date
    Feb 2005

    Unhappy Terminating a program

    I'm writing a program and I'm having problems getting it the program to close when a certain event happens. The problem is because most sections of my code are within void functions, including the section involving termination of the program. I know return terminates a function but that only closes the program if its used it main.

    My question is simply this. How would I get a program to close out when a certain event (that is defined in a void) happens?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    #include <cstdlib>
    // then later, inside some function
    exit( EXIT_FAILURE );
    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. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Terminating a GLUT program?
    By glo in forum Game Programming
    Replies: 4
    Last Post: 07-05-2006, 02:37 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM