—
NAME
EXIT_SUCCESS, EXIT_FAILURE - termination status constants
LIBRARY
Standard C library (libc)
SYNOPSIS
bash
#include <stdlib.h>bash
#define EXIT_SUCCESS \n0
\n#define EXIT_FAILURE \n/* nonzero */DESCRIPTION
EXIT_SUCCESS and EXIT_FAILURE represent a successful and unsuccessful exit status respectively, and can be used as arguments to the exit(3) function.
STANDARDS
C11, POSIX.1-2008.
HISTORY
C89, POSIX.1-2001.
EXAMPLES
bash
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
\n
FILE *fp;
\n
if (argc != 2) {
\n
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
\n
exit(EXIT_FAILURE);
\n
}
\n
fp = fopen(argv[1], "r");
\n
if (fp == NULL) {
\n
perror(argv[1]);
\n
exit(EXIT_FAILURE);
\n
}
\n
/* Other code omitted */
\n
fclose(fp);
\n
exit(EXIT_SUCCESS);
}SEE ALSO
exit(3), sysexits.h(3head)