Description
Terminates program after clean up.
Include
<stdlib.h>
Prototype
void exit(int status);
Argument
status
- exit status
Remarks
The exit
function esets the processor without calling any
functions registered by atexit
. This function is customizable. See
pic30-libs
.
Example
#include <stdio.h> /* for fopen, printf, */
/* FILE, NULL */
#include <stdlib.h> /* for _Exit */
int main(void)
{
FILE *myfile;
if ((myfile = fopen("samp.fil", "r" )) == NULL)
{
printf("Cannot open samp.fil\n");
_Exit(EXIT_FAILURE);
}
else
{
printf("Success opening samp.fil\n");
_Exit(EXIT_SUCCESS);
}
printf("This will not be printed");
}
Example Output
Cannot open samp.fil