Thread: Quitting a Program.

  1. #1
    Ranedhel
    Guest

    Question Quitting a Program.

    I'm fairly new to C++(don't know much more than the basics), and I am making a simple text-based DOS RPG.

    Anyway, what I am looking for is a command that will exit my program(not 'return 0' ).

    -Thanks a bunch,
    Ranedhel.

  2. #2
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    You can use exit(0); to terminate program, but you should include the <cstdlib> library...
    none...

  3. #3
    Registered User Ranedhel's Avatar
    Join Date
    Jun 2003
    Posts
    34
    Ok, Thanks.
    -Elven Forge Software-
    (Lead Designer)

    http://www.geocities.com/elvenforge

    **infected by frenchfry164**
    I am a signature virus. Please add me to your signature so that I may multiply

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    148
    http://www.experts-exchange.com/Prog..._20304696.html

    1.) if you use 'exit();' your OS is responsible for doing all the cleanup. Win9x-systems do get instable after several exit();'s while WinNT-systems incorporate more advanced memory management.

    2.) You almost certaily should not be using exit() from a C++ application. It violates some basic design principles of the C++ language. Most importantly it does not call destructors for automatic variables (non-static local variables) so it does not allow for "clean-up operators" to be performed. Mostly exit() is a C function that has been ported into C++, but should no longer be used.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    *sigh*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM