exit()

terminate a program 

Function


SYNOPSIS

#include <stdlib.h>

void exit(int status);


DESCRIPTION

The exit() function causes normal program termination to occur. If a program executes more than one call to the exit() function, the behavior is undefined.

First, exit() calls all functions registered by the atexit() function in the reverse order of their registration. Next, exit() flushes all open streams with unwritten buffered data, and closes all open streams. Last, exit() returns control to the host environment by calling _exit(status).

If the value of status is zero or EXIT_SUCCESS, exit() returns an implementation-defined form of the status successful termination. If the value of status is EXIT_FAILURE, it returns an implementation-defined form of the status unsuccessful termination.

The exit() function has the effect of fclose() on every open stream, with the properties of fclose().

Do not call exit() from a function registered by atexit().

For maximum portability, use only the EXIT_SUCCESS and EXIT_FAILURE macros for status.


PARAMETERS

status 

Indicates the value to be returned to the parent process.


RETURN VALUES

The exit() function cannot return to its caller.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

If NuTCRACKER Platform applications exit as a result of an unhandled exception, the NuTCRACKER Platform calls the Win32 function ExitProcess() with a Win32 exception code. waitpid() translates this to a UNIX exit code. See api_intro.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

api_intro

Functions:
_exit(), atexit(), fclose()


PTC MKS Toolkit 10.4 Documentation Build 39.