## **Overview**
**Related Modules:**
[UTILS](UTILS.md)
**Description:**
Declares common functions used for performing I/O operations.
You can use the functions provided in this file to complete string conversion, random number generation, array sorting, and tree-related operations during development.
**Since:**
1.0
**Version:**
1.0
## **Summary**
## Data Structures
Defines the structures of the division operation result. | |
Defines the structures of the division operation result. | |
Defines the structures of the division operation result. |
## Functions
atoi (const char *nptr) | Converts an input string to an integer. |
atol (const char *nptr) | Converts an input string to a long integer. |
atoll (const char *nptr) | Converts a string to an 8-byte long integer. |
atof (const char *nptr) | Converts an input string to a double-precision floating-point number. |
strtof (const char *nptr, char **endptr) | Converts an input string to a floating-point number. |
strtod (const char *nptr, char **endptr) | |
strtold (const char *nptr, char **endptr) | Converts a string to long double. |
strtol (const char *nptr, char **endptr, int base) | Converts a string to a long integer according to the given base. |
strtoul (const char *nptr, char **endptr, int base) | Converts a string to an unsigned long integer according to the given base. |
strtoll (const char *nptr, char **endptr, int base) | Converts a string to a long long integer according to the given base. |
strtoull (const char *nptr, char **endptr, int base) | Converts a string to an unsigned long long integer according to the given base. |
rand (void) | Generates a pseudo-random number. |
srand (unsigned int seed) | Initializes a random number generator. |
malloc (size_t size) | Dynamically allocates a memory block of size. |
calloc (size_t nmemb, size_t size) | Dynamically allocates nmemb memory blocks of size. |
realloc (void *ptr, size_t size) | Changes the size of the memory block pointed to by ptr to size bytes. |
free (void *ptr) | Releases the memory space pointed to by ptr. |
abort (void) | Terminates an abnormal process and sends the SIGABRT signal to the caller. |
atexit (void(*func)(void)) | Registers a termination function. |
exit (int status) | Terminates the calling process, clears the used memory space and various data structures in the kernel, and sends the process end status to the parent process. All functions registered with atexit and on_exit are called in the reverse order. |
getenv (const char *name) | Obtains the value of an environment variable. |
_Exit (int status) | Terminates the calling process, clears the used memory space and various data structures in the kernel, and sends the process end status to the parent process. |
assert (scalar expression) | Aborts the program if assertion is false. |
secure_getenv (const char *name) | Obtains the value of an environment variable. |
bsearch (const void *key, const void *base, size_t nel, size_t width, int(*compar)(const void *, const void *)) | Searches for key using the binary search algorithm from the array element base[0] to base[num-1]. |
qsort (const void *base, size_t nel, size_t width, int(*compar)(const void *, const void *)) | Sorts array elements base[0] to base[num-1] based on the comparison rules of compar. |
abs (int i) | Obtains the absolute value of an integer value. |
labs (long i) | Calculates the absolute value of a long integer. |
llabs (long long i) | Calculates the absolute value of a long long integer. |
div (int numerator, int denominator) | Calculates the quotient and remainder of an integer after division. |
ldiv (long numerator, long denominator) | Calculates the quotient and remainder of a long integer after division. |
lldiv (long long numerator, long long denominator) | Calculates the quotient and remainder of a long long integer after division. |
mblen (const char *s, size_t n) | Obtains the number of bytes in the next multi-byte string. |
mbtowc (wchar_t *pwc, const char *s, size_t n) | Converts a string constant to a wide character. |
wctomb (char *s, wchar_t wc) | Converts a wide character to its multi-byte sequence and stores it in a character array. |
mbstowcs (wchar_t *dest, const char *src, size_t n) | Converts a multi-byte string to a wide-character string. |
wcstombs (char *dest, const wchar_t *src, size_t n) | Converts a wide-character string to a multi-byte string. |
posix_memalign (void **memptr, size_t alignment, size_t size) | Allocates memory with the specified size based on the given alignment. |
setenv (const char *name, const char *value, int overwrite) | Add or change an environment variable. |
unsetenv (const char *name) | Deletes an environment variable. |
mkstemp (char *template) | Creates and opens a unique temporary file. |
mkostemp (char *template, int flags) | Creates and opens a unique temporary file. |
mkdtemp (char *template) | Creates a unique temporary directory based on template. |
getsubopt (char **optionp, char *const *tokens, char **valuep) | Processes the parameters of an option in the command line. |
rand_r (unsigned *seedp) | Generates a pseudo-random number. |
realpath (const char *__restrict path, char *__restrict resolved) | Obtains a normalized absolute path. |
random (void) | Generates a pseudo-random number. |
srandom (unsigned int seed) | Initializes a random number generator. |
initstate (unsigned int seed, char *state, size_t n) | Initializes a random number generator. |
setstate (char *state) | Sets the current state list for subsequent random use. |
putenv (char *s) | Configures an environment variable. |
unlockpt (int fd) | Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal. |
ptsname (int fd) | Obtains the name of a pseudo terminal. |
l64a (long value) | Converts a long integer to a 64-bit ASCII string. |
a64l (const char *str64) | Converts between a 32-bit long integer and a little-endian 64-bit ASCII string. |
drand48 (void) | |
erand48 (unsigned short xsubi[3]) | |
lrand48 (void) | Generates pseudo-random numbers evenly distributed between [0, 2^31). |
nrand48 (unsigned short xsubi[3]) | Generates pseudo-random numbers evenly distributed between [0, 2^31). |
mrand48 (void) | Generates pseudo-random numbers evenly distributed between [-2^31, 2^31). |
jrand48 (unsigned short xsubi[3]) | Generates pseudo-random numbers evenly distributed between [-2^31, 2^31). |
srand48 (long int seedval) | Sets the start seed value for the pseudo-random number generator. |
seed48 (unsigned short[3]) | Generates an evenly distributed pseudo-random seed. |
lcong48 (unsigned short param[7]) | Sets the seed and related algorithm parameters for the pseudo-random number generator. |
mktemp (char *template) | Creates a unique temporary file name. |
mkstemps (char *template, int suffixlen) | Creates and opens a unique temporary file. |
mkostemps (char *template, int suffixlen, int flags) | Creates and opens a unique temporary file. |
valloc (size_t size) | Allocates memory with the specified size and aligns the allocated memory by page size. |
ecvt (double number, int ndigits, int *decpt, int *sign) | Converts a double-precision floating-point number into a string. |
fcvt (double number, int ndigits, int *decpt, int *sign) | Converts a floating-point number to a string. |
gcvt (double x, int n, char *b) | Converts a floating-point number to a string. |