EXIT_SUCCESS
(3const)termination status constants
#include <stdlib.h> #define EXIT_SUCCESS 0 #define EXIT_FAILURE /* nonzero */
LIBRARY
DESCRIPTION
STANDARDS
HISTORY
EXAMPLES
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
FILE *fp;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(EXIT_FAILURE);
}
fp = fopen(argv[1], "r");
if (fp == NULL) {
perror(argv[1]);
exit(EXIT_FAILURE);
}
/* Other code omitted */
fclose(fp);
exit(EXIT_SUCCESS);
}