1<stdlib.h>(0P)             POSIX Programmer's Manual            <stdlib.h>(0P)
2
3
4

NAME

6       stdlib.h - standard library definitions
7

SYNOPSIS

9       #include <stdlib.h>
10

DESCRIPTION

12       Some  of the functionality described on this reference page extends the
13       ISO C standard. Applications shall define the appropriate feature  test
14       macro  (see  the System Interfaces volume of IEEE Std 1003.1-2001, Sec‐
15       tion 2.2, The Compilation Environment)  to  enable  the  visibility  of
16       these symbols in this header.
17
18       The <stdlib.h> header shall define the following macros:
19
20       EXIT_FAILURE
21              Unsuccessful  termination  for  exit();  evaluates to a non-zero
22              value.
23
24       EXIT_SUCCESS
25              Successful termination for exit(); evaluates to 0.
26
27       NULL   Null pointer.
28
29       {RAND_MAX}
30              Maximum value returned by rand(); at least 32767.
31
32       {MB_CUR_MAX}
33              Integer expression whose value is the maximum number of bytes in
34              a character specified by the current locale.
35
36
37       The following data types shall be defined through typedef:
38
39       div_t  Structure type returned by the div() function.
40
41       ldiv_t Structure type returned by the ldiv() function.
42
43       lldiv_t
44              Structure type returned by the lldiv() function.
45
46       size_t As described in <stddef.h> .
47
48       wchar_t
49              As described in <stddef.h> .
50
51
52       In  addition,  the following symbolic names and macros shall be defined
53       as in <sys/wait.h>, for use in decoding the return value from system():
54
55       WNOHANG
56       WUNTRACED
57       WEXITSTATUS
58       WIFEXITED
59       WIFSIGNALED
60       WIFSTOPPED
61       WSTOPSIG
62       WTERMSIG
63
64
65       The following shall be declared as functions and may also be defined as
66       macros. Function prototypes shall be provided.
67
68
69              void          _Exit(int);
70
71              long          a64l(const char *);
72
73              void          abort(void);
74              int           abs(int);
75              int           atexit(void (*)(void));
76              double        atof(const char *);
77              int           atoi(const char *);
78              long          atol(const char *);
79              long long     atoll(const char *);
80              void         *bsearch(const void *, const void *, size_t, size_t,
81                                int (*)(const void *, const void *));
82              void         *calloc(size_t, size_t);
83              div_t         div(int, int);
84
85              double        drand48(void);
86              char         *ecvt(double, int, int *restrict, int *restrict); (LEGACY )
87              double        erand48(unsigned short[3]);
88
89              void          exit(int);
90
91              char         *fcvt(double, int, int *restrict, int *restrict); (LEGACY )
92
93              void          free(void *);
94
95              char         *gcvt(double, int, char *); (LEGACY )
96
97              char         *getenv(const char *);
98
99              int           getsubopt(char **, char *const *, char **);
100              int           grantpt(int);
101              char         *initstate(unsigned, char *, size_t);
102              long          jrand48(unsigned short[3]);
103              char         *l64a(long);
104
105              long          labs(long);
106
107              void          lcong48(unsigned short[7]);
108
109              ldiv_t        ldiv(long, long);
110              long long     llabs(long long);
111              lldiv_t       lldiv(long long, long long);
112
113              long          lrand48(void);
114
115              void         *malloc(size_t);
116              int           mblen(const char *, size_t);
117              size_t        mbstowcs(wchar_t *restrict, const char *restrict, size_t);
118              int           mbtowc(wchar_t *restrict, const char *restrict, size_t);
119
120              char         *mktemp(char *); (LEGACY )
121              int           mkstemp(char *);
122              long          mrand48(void);
123              long          nrand48(unsigned short[3]);
124
125
126              int           posix_memalign(void **, size_t, size_t);
127
128
129              int           posix_openpt(int);
130              char         *ptsname(int);
131              int           putenv(char *);
132
133              void          qsort(void *, size_t, size_t, int (*)(const void *,
134                                const void *));
135              int           rand(void);
136
137              int           rand_r(unsigned *);
138
139
140              long          random(void);
141
142              void         *realloc(void *, size_t);
143
144              char         *realpath(const char *restrict, char *restrict);
145              unsigned short seed48(unsigned short[3]);
146
147
148              int           setenv(const char *, const char *, int);
149
150
151              void          setkey(const char *);
152              char         *setstate(const char *);
153
154              void          srand(unsigned);
155
156              void          srand48(long);
157              void          srandom(unsigned);
158
159              double        strtod(const char *restrict, char **restrict);
160              float         strtof(const char *restrict, char **restrict);
161              long          strtol(const char *restrict, char **restrict, int);
162              long double   strtold(const char *restrict, char **restrict);
163              long long     strtoll(const char *restrict, char **restrict, int);
164              unsigned long strtoul(const char *restrict, char **restrict, int);
165              unsigned long long
166                            strtoull(const char *restrict, char **restrict, int);
167              int           system(const char *);
168
169              int           unlockpt(int);
170
171
172              int           unsetenv(const char *);
173
174              size_t        wcstombs(char *restrict, const wchar_t *restrict, size_t);
175              int           wctomb(char *, wchar_t);
176
177       Inclusion  of  the  <stdlib.h> header may also make visible all symbols
178       from <stddef.h>, <limits.h>, <math.h>, and <sys/wait.h>.
179
180       The following sections are informative.
181

APPLICATION USAGE

183       None.
184

RATIONALE

186       None.
187

FUTURE DIRECTIONS

189       None.
190

SEE ALSO

192       <limits.h>, <math.h>, <stddef.h>, <sys/types.h>, <sys/wait.h>, the Sys‐
193       tem   Interfaces   volume  of  IEEE Std 1003.1-2001,  _Exit(),  a64l(),
194       abort(), abs(), atexit(), atof(), atoi(), atol(),  atoll(),  bsearch(),
195       calloc(),  div(),  drand48(), erand48(), exit(), free(), getenv(), get‐
196       subopt(), grantpt(), initstate(), jrand48(), l64a(), labs(), lcong48(),
197       ldiv(),  llabs(),  lldiv(),  lrand48(),  malloc(), mblen(), mbstowcs(),
198       mbtowc(), mkstemp(), mrand48(), nrand48(), posix_memalign(), ptsname(),
199       putenv(),  qsort(), rand(), realloc(), realpath(), setstate(), srand(),
200       srand48(), srandom(), strtod(),  strtof(),  strtol(),  strtold(),  str‐
201       toll(), strtoul(), strtoull(), unlockpt(), wcstombs(), wctomb()
202
204       Portions  of  this text are reprinted and reproduced in electronic form
205       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
206       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
207       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
208       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
209       event of any discrepancy between this version and the original IEEE and
210       The  Open Group Standard, the original IEEE and The Open Group Standard
211       is the referee document. The original Standard can be  obtained  online
212       at http://www.opengroup.org/unix/online.html .
213
214
215
216IEEE/The Open Group                  2003                       <stdlib.h>(0P)
Impressum