-
exit() ?
hello,
I have been trying to use exit() as a way to exit the program when it meets certain conditions...the complier I'm using is codewarrior...however whenever I use exit(), the error I get is: "undefined identifier 'exit' ", I have used exit() before in UNIX and it worked fine...is there a subtitute for exit(), or is it in some specific library that I need to include??...I have included
iostream.h in my code... any help will be appreciated...thanks.
-
#include <stdlib.h>
or
#include <cstdlib>
-
thanks....that did work....
-
I think you should include <cstdlib> and I Think that it takes an integer argument, as far as I know, exit(0) if it exits without an error and a non zero value for exiting with an error.
Ammar.
-
the exit() function uses DOS's exitcode,so its probably best to use return instead,unless you want to send a 0 exitcode,meaning no errors,or non-zero meaning an/some error(s)