Am i using the exit() func correctly?

This is a discussion on Am i using the exit() func correctly? within the C Programming forums, part of the General Programming Boards category; hi there...I am using the exit() function in my program and it gives me the following warning: "warning C4013: 'exit' ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    6

    Am i using the exit() func correctly?

    hi there...I am using the exit() function in my program and it gives me the following warning:

    "warning C4013: 'exit' undefined; assuming extern returning int"

    When i include the header file stdlib.h, i get the following error:

    "error C2198: 'exit' : too few actual parameters"


    any ideas/help will be appreciated...cheers!

  2. #2
    Max
    Max is offline
    Registered User Max's Avatar
    Join Date
    Jul 2002
    Posts
    110
    exit alone does nothing

    it should be

    exit(1);

  3. #3
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    If your prog must exit on an error then use it like this : exit(1)
    Otherwise use exit(0)

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    6

    all's well...

    thanx boyz...cheers!

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >If your prog must exit on an error then use it like this : exit(1)
    Don't do this if you want your program to be standard. There are only three portable arguments to exit: 0, EXIT_SUCCESS, and EXIT_FAILURE. Anything else is implementation-defined.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 01:56 AM
  2. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 10:23 PM
  3. Dynamic array of pointers
    By csisz3r in forum C Programming
    Replies: 8
    Last Post: 09-25-2005, 03:06 PM
  4. typedef a func
    By trekker in forum C Programming
    Replies: 4
    Last Post: 07-02-2002, 06:15 AM
  5. Delete & print func()
    By spentdome in forum C Programming
    Replies: 5
    Last Post: 05-29-2002, 10:02 AM

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