stdlib.h - standard library definitions
stdlib.h is a
C library header file. It is also
availible in
C++, though there are some
minor changes.
- This header file defines the following macro names:
- EXIT_FAILURE
- Unsuccessful termination for exit(), evaluates to a non-zero value.
- EXIT_SUCCESS
- Successful termination for exit(), evaluates to 0.
- NULL
- Null pointer.
- RAND_MAX
- Maximum value returned by rand(), at least 32,767.
- MB_CUR_MAX
- Integer expression whose value is the maximum number of bytes in a character specified by the current locale.
- The following data types are defined through typedef:
- div_t
- Structure type returned by div() function.
- ldiv_t
- Structure type returned by ldiv() function.
- size_t
- As described in <stddef.h>.
- wchar_t
- As described in <stddef.h>.
- In addition, the following symbolic names and macros are defined as in , for use in decoding the return value from system():
- WNOHANG
- WUNTRACED
- WEXITSTATUS()
- WIFEXITED()
- WIFSIGNALED()
- WIFSTOPPED()
- WSTOPSIG()
- WTERMSIG()
- The following are declared as functions and may also be defined as macros. Function prototypes must be provided for use with an ISO C compiler.
- long a64l(const char *);
- convert between a a radix-64 ASCII string and a 32-bit integer
- void abort(void);
- generate an abnormal process abort
- int abs(int);
- return an integer absolute value
- int atexit(void (*)(void));
- register a function to run at process termination
- double atof(const char *);
- convert a string to double-precision number
- int atoi(const char *);
- convert a string to integer
- long atol(const char *);
- convert a string to long integer
- void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
- binary search a sorted table
- void *calloc(size_t, size_t);
- allocates memory and zeros it
- div_t div(int, int);
- compute the quotient and remainder of an integer division
- double drand48(void);
- return non-negative, double-precision, floating-point values, uniformly distributed over the interval 0.0 , 1.0
- char *ecvt(double, int, int *, int *);
- convert a floating-point number to a string
- double erand48(unsigned short[3]);
- return non-negative, double-precision, floating-point values, uniformly distributed over the interval 0.0 , 1.0
- void exit(int);
- terminate a process
- char *fcvt (double, int, int *, int *);
- convert a floating-point number to a string
- void free(void *);
- free allocated memory
- char *gcvt(double, int, char *);
- convert a floating-point number to a string
- char *getenv(const char *);
- get value of an environment variable
- int getsubopt(char **, char *const *, char **);
- parse suboption arguments from a string
- int grantpt(int);
- grant access to the slave pseudo-terminal device
- char *initstate(unsigned int, char *, size_t);
- pseudorandom number functions
- long int jrand48(unsigned short[3]);
- generate a uniformly distributed pseudo-random long signed integer
- char *l64a(long);
- convert a 32-bit integer to a radix-64 ASCII string
- long int labs(long);
- return a long integer absolute value
- void lcong48(unsigned short[7]);
- seed a uniformly distributed pseudo-random signed long integer generator
- ldiv_t ldiv(long, long);
- compute quotient and remainder of a long division
- long lrand48(void);
- generate uniformly distributed pseudo-random non-negative long integers
- void *malloc(size_t);
- a memory allocator
- int mblen(const char *, size_t);
- get number of bytes in a character
- size_t mbstowcs(wchar_t *, const char *, size_t);
- convert a character string to a wide-character string
- int mbtowc(wchar_t *, const char *, size_t);
- convert a character to a wide-character code
- char *mktemp(char *);
- make a unique filename
- int mkstemp(char *);
- make a unique file name
- long mrand48(void);
- generate uniformly distributed pseudo-random signed long integers
- long nrand48(unsigned short int [3]);
- generate uniformly distributed pseudo-random non-negative long integers
- char *ptsname(int);
- get name of the slave pseudo-terminal device
- int putenv(char *);
- change or add a value to environment
- void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
- quick sort a table of data
- int rand(void);
- pseudo-random number generator
- int rand_r(unsigned int *);
- pseudo-random number generator
- long random(void);
- generate pseudorandom number
- void *realloc(void *, size_t);
- memory reallocator
- char *realpath(const char *, char *);
- resolve a pathname
- unsigned short seed48(unsigned short[3]);
- seed uniformly distributed pseudo-random non-negative long integer generator
- void setkey(const char *);
- set encoding key
- char *setstate(const char *);
- switch pseudorandom number generator state arrays
- void srand(unsigned int);
- seed simple pseudo-random number generator
- void srand48(long int);
- seed uniformly distributed double-precision pseudo-random number generator
- void srandom(unsigned);
- seed pseudorandom number generator
- double strtod(const char *, char **);
- convert string to a double-precision number
- long strtol(const char *, char **, int);
- convert string to a long integer
- unsigned long strtoul(const char *, char **, int);
- convert string to an unsigned long
- int system(const char *);
- issue a command
- int ttyslot(void); (LEGACY)
- find the slot of the current user in the user accounting database
- int unlockpt(int);
- unlock a pseudo-terminal master/slave pair
- void *valloc(size_t); (LEGACY)
- page-aligned memory allocator
- size_t wcstombs(char *, const wchar_t *, size_t);
- convert a wide-character string to a character string
- int wctomb(char *, wchar_t);
- convert a wide-character code to a character
Inclusion of the header may also make visible all symbols from <stddef.h>, <limits.h>, <math.h> and <sys/wait.h>.