1EXIT_SUCCESS(3const)                                      EXIT_SUCCESS(3const)
2
3
4

NAME

6       EXIT_SUCCESS, EXIT_FAILURE - termination status constants
7

LIBRARY

9       Standard C library (libc)
10

SYNOPSIS

12       #include <stdlib.h>
13
14       #define EXIT_SUCCESS  0
15       #define EXIT_FAILURE  /* nonzero */
16

DESCRIPTION

18       EXIT_SUCCESS  and  EXIT_FAILURE represent a successful and unsuccessful
19       exit status respectively, and can be used as arguments to  the  exit(3)
20       function.
21

CONFORMING TO

23       C99 and later; POSIX.1-2001 and later.
24

EXAMPLES

26       #include <stdio.h>
27       #include <stdlib.h>
28
29       int
30       main(int argc, char *argv[])
31       {
32           FILE *fp;
33
34           if (argc != 2) {
35               fprintf(stderr, "Usage: %s <file>\n", argv[0]);
36               exit(EXIT_FAILURE);
37           }
38
39           if ((fp = fopen(argv[1], "r")) == NULL) {
40               perror(argv[1]);
41               exit(EXIT_FAILURE);
42           }
43
44           /* Other code omitted */
45
46           fclose(fp);
47           exit(EXIT_SUCCESS);
48       }
49

SEE ALSO

51       exit(3), sysexits.h(3head)
52
53
54
55Linux man-pages 6.04              2022-11-17              EXIT_SUCCESS(3const)
Impressum