Computing.Net > Forums > Programming > Exit code in C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Exit code in C++

Reply to Message Icon

Name: R.Hillier
Date: July 1, 2002 at 08:31:26 Pacific
Comment:

Is it safe to use the exit() with a generated value.ie: exit(101);
this generated value is read for a text file.
... I can't use the return()method, because the CALL programme is only detecting the exit code.



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: July 1, 2002 at 09:33:37 Pacific
Reply:

Yes it is safe unless you have a multi-threaded program.

exit() will kill the current thread as will and return. However, exit will call the functions registered by atexit and _onexit and flush all the buffers. This is fine for single threaded programs. For multi-threaded programs, it just exits the current thread.

There is also _exit() which will kill the program without calling the functions registered by atexit etc and all its threads.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Exit code in C++

Switch statement code in C++ ..? www.computing.net/answers/programming/switch-statement-code-in-c-/6052.html

getting Perl exit codes in vb www.computing.net/answers/programming/getting-perl-exit-codes-in-vb/17613.html

ungetc in c++ www.computing.net/answers/programming/ungetc-in-c/8266.html