void exit ( int status );
Terminate calling process.
The process performs standard cleanup and then terminates. Before the cleanup is done any function registered by atexit is called. The cleanup consists on flushing all buffers and close any open files.
The status parameter is returned to the parent of the process (if any) or the operating system as if a return statement was specified in main function. Generally a return value of 0 or constant EXIT_SUCCESS indicates success and any other value or constant EXIT_FAILURE is used to inidcate an error or an abnormal program termination.
status value description EXIT_SUCCESS 0 Normal termination EXIT_FAILURE 1 Abnormal termination. Error in process.
Defined in ANSI-C.
/* exit example */
FILE * pFile;
pFile = open ("myfile.txt","r");
printf ("Error opening file");
/* file operations here */