- UTILS
- Overview
- Summary
- Files
- Data Structures
- Macros
- Typedefs
- Functions
- Details
- Macro Definition Documentation
- _tolower
- _toupper
- isascii
- strdupa
- va_arg
- va_copy
- va_end
- va_start
- Function Documentation
- _Exit()
- _exit()
- a64l()
- abort()
- abs()
- access()
- alarm()
- assert()
- atexit()
- atof()
- atoi()
- atol()
- atoll()
- bcmp()
- bcopy()
- bsearch()
- btowc()
- bzero()
- calloc()
- chdir()
- chown()
- close()
- crypt()
- div()
- drand48()
- dup()
- dup2()
- ecvt()
- erand48()
- execl()
- execle()
- execlp()
- execv()
- execve()
- execvp()
- exit()
- fcvt()
- ffs()
- ffsl()
- ffsll()
- fgetwc()
- fgetws()
- fmtmsg()
- fnmatch()
- fork()
- fputwc()
- fputws()
- free()
- fsync()
- ftruncate()
- fwide()
- fwprintf()
- fwscanf()
- gcvt()
- get_current_dir_name()
- getcwd()
- getegid()
- getenv()
- geteuid()
- getgid()
- getgroups()
- getopt()
- getopt_long()
- getopt_long_only()
- getpagesize()
- getpgid()
- getpgrp()
- getpid()
- getppid()
- getresgid()
- getresuid()
- getsubopt()
- getuid()
- getwc()
- getwchar()
- hcreate()
- hcreate_r()
- hdestroy()
- hdestroy_r()
- hsearch()
- hsearch_r()
- imaxabs()
- imaxdiv()
- index()
- initstate()
- insque()
- isalnum()
- isalnum_l()
- isalpha()
- isalpha_l()
- isblank()
- isblank_l()
- iscntrl()
- iscntrl_l()
- isdigit()
- isdigit_l()
- isgraph()
- isgraph_l()
- islower()
- islower_l()
- isprint()
- isprint_l()
- ispunct()
- ispunct_l()
- isspace()
- isspace_l()
- isupper()
- isupper_l()
- iswalnum()
- iswalnum_l()
- iswalpha()
- iswalpha_l()
- iswblank()
- iswblank_l()
- iswcntrl()
- iswcntrl_l()
- iswctype()
- iswctype_l()
- iswdigit()
- iswdigit_l()
- iswgraph()
- iswgraph_l()
- iswlower()
- iswlower_l()
- iswprint()
- iswprint_l()
- iswpunct()
- iswpunct_l()
- iswspace()
- iswspace_l()
- iswupper()
- iswupper_l()
- iswxdigit()
- iswxdigit_l()
- isxdigit()
- isxdigit_l()
- jrand48()
- l64a()
- labs()
- lcong48()
- ldiv()
- lfind()
- llabs()
- lldiv()
- lrand48()
- lsearch()
- lseek()
- malloc()
- mblen()
- mbrlen()
- mbrtowc()
- mbsinit()
- mbsnrtowcs()
- mbsrtowcs()
- mbstowcs()
- mbtowc()
- memccpy()
- memchr()
- memcmp()
- memcpy()
- memmem()
- memmove()
- mempcpy()
- memrchr()
- memset()
- mkdtemp()
- mkostemp()
- mkostemps()
- mkstemp()
- mkstemps()
- mktemp()
- mrand48()
- nrand48()
- pathconf()
- pause()
- pipe()
- posix_memalign()
- pread()
- ptsname()
- putenv()
- putwc()
- putwchar()
- pwrite()
- qsort()
- rand()
- rand_r()
- random()
- read()
- realloc()
- realpath()
- remque()
- rindex()
- rmdir()
- sbrk()
- secure_getenv()
- seed48()
- setegid()
- setenv()
- seteuid()
- setgid()
- setgroups()
- setpgid()
- setpgrp()
- setregid()
- setresgid()
- setresuid()
- setreuid()
- setstate()
- setuid()
- sleep()
- srand()
- srand48()
- srandom()
- stpcpy()
- stpncpy()
- strcasecmp()
- strcasestr()
- strcat()
- strchr()
- strcmp()
- strcoll()
- strcoll_l()
- strcpy()
- strcspn()
- strdup()
- strerror()
- strerror_l()
- strerror_r()
- strfmon()
- strlcat()
- strlcpy()
- strlen()
- strncasecmp()
- strncat()
- strncmp()
- strncpy()
- strndup()
- strnlen()
- strpbrk()
- strrchr()
- strsep()
- strsignal()
- strspn()
- strstr()
- strtod()
- strtof()
- strtoimax()
- strtok()
- strtok_r()
- strtol()
- strtold()
- strtoll()
- strtoul()
- strtoull()
- strtoumax()
- strverscmp()
- strxfrm()
- swab()
- swprintf()
- swscanf()
- tdelete()
- tdestroy()
- tfind()
- toascii()
- tolower()
- tolower_l()
- toupper()
- toupper_l()
- towctrans()
- towctrans_l()
- towlower()
- towlower_l()
- towupper()
- towupper_l()
- truncate()
- tsearch()
- twalk()
- ualarm()
- ungetwc()
- unlink()
- unlinkat()
- unlockpt()
- unsetenv()
- usleep()
- valloc()
- vfwprintf()
- vfwscanf()
- vswprintf()
- vswscanf()
- vwprintf()
- vwscanf()
- wcpcpy()
- wcpncpy()
- wcrtomb()
- wcscasecmp()
- wcscasecmp_l()
- wcscat()
- wcschr()
- wcscmp()
- wcscoll()
- wcscoll_l()
- wcscpy()
- wcscspn()
- wcsdup()
- wcsftime()
- wcslen()
- wcsncasecmp()
- wcsncasecmp_l()
- wcsncat()
- wcsncmp()
- wcsncpy()
- wcsnlen()
- wcsnrtombs()
- wcspbrk()
- wcsrchr()
- wcsrtombs()
- wcsspn()
- wcstod()
- wcstof()
- wcstoimax()
- wcstok()
- wcstol()
- wcstold()
- wcstoll()
- wcstombs()
- wcstoul()
- wcstoull()
- wcstoumax()
- wcswcs()
- wcsxfrm()
- wcsxfrm_l()
- wctob()
- wctomb()
- wctrans()
- wctrans_l()
- wctype()
- wctype_l()
- wmemchr()
- wmemcmp()
- wmemcpy()
- wmemmove()
- wmemset()
- wprintf()
- write()
- wscanf()
UTILS
Overview
Provides functions and data structures related to system operations, such as string conversion and I/O, string operations, process operations and so on.
Since:
1.0
Version:
1.0
Summary
Files
Data Structures
Creates a queue from the doubly linked list for insque and remque. |
|
Macros
Too many opened files in system (the maximum number exceeded) |
|
Too many opened files in a process (the maximum number exceeded) |
|
The pipe file is incorrect or the read end of the pipe is closed during the write operation. |
|
Domain error. The value of at least one input parameter is out of the parameter range. |
|
EWOULDBLOCK EAGAIN |
Operation would block (the same value as EAGAIN) |
EDEADLOCK EDEADLK |
Resource deadlock (the same value as EDEADLK) |
ENOTSUP EOPNOTSUPP |
Operation not supported on socket. The value is the same as that of EOPNOTSUPP. |
_tolower(a) ((a)|0x20) |
|
_toupper(a) ((a)&0x5f) |
|
isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) |
|
No severity level is set, equivalent to MM_NULLSEV. |
|
If this flag is set, a slash (/) in string can be matched by a slash (/) in pattern, but not by an asterisk (), or a question mark (?), or a bracket expression ([]) containing a slash. |
|
If this flag is set, the backslash () is treated as an ordinary character, instead of an escape character. |
|
If this flag is set, a leading period (.) in string can be exactly matched by the period (.) in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. |
|
If this flag is set, a trailing sequence of characters starting with a slash (/) is ignored in string. For example, if this flag is set, either foo or foobar as a pattern would match the string foobar/frobozz. |
|
If this flag is set, the pattern is matched case-insensitively. |
|
FNM_FILE_NAME FNM_PATHNAME |
The definition is similar to that of FNM_PATHNAME. |
LONG_MIN (-LONG_MAX-1) |
|
LONG_MAX LONG_MAX |
|
ULONG_MAX (2ULLONG_MAX+1) |
|
LLONG_MIN (-LLONG_MAX-1) |
|
ULLONG_MAX (2ULLLLONG_MAX+1) |
|
SSIZE_MAX LONG_MAX |
|
PAGE_SIZE PAGESIZE |
|
va_start(v, l) builtin_va_start(v,l) |
Defines the start position of the variable-length argument list. |
va_end(v) builtin_va_end(v) |
|
va_arg(v, l) builtin_va_arg(v,l) |
Obtains the next argument in the variable-length argument list. |
va_copy(d, s) __builtin_va_copy(d,s) |
Copies the previously initialized variable argument list s to d. |
Relocation starts from the position of the currently accessed file. |
|
Typedefs
typedef struct entry |
Functions
crypt (const char key, const char setting) |
|
isalnum (int c) |
Checks whether a parameter is an alphabetic character or a decimal digit. |
isalpha (int c) |
|
isblank (int c) |
Checks whether a parameter is a blank character (space or tap). |
iscntrl (int c) |
Checks whether a parameter is a control character. A control character is invisible and does not occupy a printing position on a display. |
isdigit (int c) |
|
isgraph (int c) |
Checks whether a parameter is any printable character except the space character. |
islower (int c) |
|
isprint (int c) |
Checks whether a parameter is a printable character (including space). |
ispunct (int c) |
Checks whether a parameter is a punctuation or special character. |
isspace (int c) |
|
isupper (int c) |
|
isxdigit (int c) |
|
tolower (int c) |
Converts an uppercase letter specified by c to its lowercase equivalent. |
toupper (int c) |
Converts a lowercase letter specified by c to its uppercase equivalent. |
isalnum_l (int c, locale_t locale) |
Checks whether a parameter is an alphabetic character or digit for the specified locale. |
isalpha_l (int c, locale_t locale) |
Checks whether a parameter is an alphabetic character for the specified locale. |
isblank_l (int c, locale_t locale) |
Checks whether a parameter is a blank character (including spaces and tabs) for the specified locale. |
iscntrl_l (int c, locale_t locale) |
Checks whether a parameter is a control character for the specified locale. |
isdigit_l (int c, locale_t locale) |
Checks whether a parameter is a decimal digit for the specified locale. |
isgraph_l (int c, locale_t locale) |
Checks whether a parameter is any printable character except the space character for the specified locale. |
islower_l (int c, locale_t locale) |
Checks whether a parameter is a character of lowercase letters for the specified locale. |
isprint_l (int c, locale_t locale) |
Checks whether a parameter is a printable character (including space) for the specified locale. A printable character is visible and occupies a printing position on a display. |
ispunct_l (int c, locale_t locale) |
Checks whether a parameter is a punctuation or special character for the specified locale. |
isspace_l (int c, locale_t locale) |
Checks whether a parameter is a blank character for the specified locale. |
isupper_l (int c, locale_t locale) |
Checks whether a parameter is a character of uppercase letters for the specified locale. |
isxdigit_l (int c, locale_t locale) |
Checks whether a parameter is a hexadecimal digit for the specified locale. |
tolower_l (int c, locale_t locale) |
Converts an upper letter specified by c to its lowercase equivalent for the specified locale. |
toupper_l (int c, locale_t locale) |
Converts a lowercase letter specified by c to its uppercase equivalent for the specified locale. |
toascii (int c) |
|
fmtmsg (long classification, const char label, int severity, const char text, const char action, const char tag) |
|
fnmatch (const char pattern, const char string, int flags) |
|
getopt_long (int argc, char const argv, const char optstring, const struct option longopts, int longindex) |
|
getopt_long_only (int argc, char const argv, const char optstring, const struct option longopts, int longindex) |
|
imaxabs (intmax_t j) |
Calculates the absolute value of an input parameter of the integer type. |
imaxdiv (intmax_t numerator, intmax_t denominator) |
Calculates the quotient and remainder after the division operation is performed on an integer. |
strtoimax (const char str, char endptr, int base) |
|
strtoumax (const char *str, char endptr, int base) |
|
wcstoimax (const wchar_t str, wchar_t **endptr, int base) |
|
wcstoumax (const wchar_t str, wchar_t endptr, int base) |
|
strfmon (char s, size_t max, const char format,…) |
|
hcreate (size_t nel) |
|
hdestroy (void) |
|
hcreate_r (size_t nel, struct hsearch_data htab) |
Creates a hash table based on the number of entries and its description. |
hdestroy_r (struct hsearch_data *htab) |
|
hsearch_r (ENTRY item, ACTION action, ENTRY retval, struct hsearch_data htab) |
|
insque (void element, void pred) |
|
remque (void elem) |
|
lsearch (const void key, const void base, size_t nelp, size_t width, int(compar)(const void , const void )) |
Performs a linear search for a key in the array and adds a key to the end of the array if the key is not found. |
lfind (const void key, const void base, size_t nelp, size_t width, int(compar)(const void , const void )) |
|
tdelete (const void key, void **rootp, int(compar)(const void , const void )) |
|
tfind (const void key, void const rootp, int(compar)(const void , const void )) |
|
tsearch (const void key, void const rootp, int(compar)(const void , const void )) |
Searches for a key in the binary tree and adds a key to the tree if the key is not found. |
twalk (const void root, void(action)(const void nodep, VISIT which, int depth)) |
|
tdestroy (void root, void(free_node)(void nodep)) |
|
atoi (const char nptr) |
|
atol (const char nptr) |
|
atoll (const char nptr) |
|
atof (const char nptr) |
Converts an input string to a double-precision floating-point number. |
strtof (const char nptr, char endptr) |
|
strtod (const char *nptr, char endptr) |
|
strtold (const char nptr, char **endptr) |
|
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) |
|
srand (unsigned int seed) |
|
malloc (size_t size) |
|
calloc (size_t nmemb, size_t size) |
|
realloc (void ptr, size_t size) |
Changes the size of the memory block pointed to by ptr to size bytes. |
free (void ptr) |
|
abort (void) |
Terminates an abnormal process and sends the SIGABRT signal to the caller. |
atexit (void(func)(void)) |
|
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) |
|
_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) |
|
secure_getenv (const char name) |
|
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) |
|
labs (long i) |
|
llabs (long long i) |
|
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) |
|
mbtowc (wchar_t pwc, const char s, size_t n) |
|
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) |
|
wcstombs (char dest, const wchar_t src, size_t n) |
|
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) |
|
unsetenv (const char name) |
|
mkstemp (char template) |
|
mkostemp (char template, int flags) |
|
mkdtemp (char template) |
|
getsubopt (char **optionp, char const tokens, char **valuep) |
|
rand_r (unsigned seedp) |
|
realpath (const char __restrict path, char restrict resolved) |
|
random (void) |
|
srandom (unsigned int seed) |
|
initstate (unsigned int seed, char state, size_t n) |
|
setstate (char state) |
|
putenv (char s) |
|
unlockpt (int fd) |
Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal. |
ptsname (int fd) |
|
l64a (long value) |
|
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]) |
|
lcong48 (unsigned short param[7]) |
Sets the seed and related algorithm parameters for the pseudo-random number generator. |
mktemp (char template) |
|
mkstemps (char template, int suffixlen) |
|
mkostemps (char template, int suffixlen, int flags) |
|
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) |
|
gcvt (double x, int n, char b) |
|
memcpy (void restrict dest, const void __restrict src, size_t n) |
|
memmove (void dest, const void src, size_t n) |
|
memset (void s, int c, size_t n) |
|
memcmp (const void s1, const void s2, size_t n) |
|
memchr (const void s, int c, size_t n) |
|
strcpy (char dest, const char src) |
|
strncpy (char dest, const char src, size_t n) |
|
strcat (char dest, const char src) |
|
strncat (char dest, const char src, size_t n) |
|
strcmp (const char s1, const char s2) |
|
strncmp (const char s1, const char s2, size_t n) |
|
strcoll (const char s1, const char s2) |
Compares two strings by character for the program’s current locale. |
strcoll_l (const char s1, const char s2, locale_t locale) |
|
strxfrm (char dest, const char src, size_t n) |
Converts the first n characters of the source string pointed to by src based on the program’s current locale specified by LC_COLLATE, and places them in the destination string pointed to by dest. |
strchr (const char s, int c) |
|
strrchr (const char s, int c) |
|
strcspn (const char s, const char reject) |
Obtains the length of the initial segment of a string that contains characters not in reject. |
Obtains the length of the initial segment of a string that contains characters in accept. |
|
strstr (const char haystack, const char needle) |
|
strtok (char str, const char delim) |
Separates a string into a series of tokens separated by a delimiter. |
strlen (const char s) |
|
strerror (int errnum) |
Obtains an error description string of the specified error code. |
strtok_r (char str, const char delim, char saveptr) |
Separates a string into a series of tokens separated by a delimiter, with the saveptr parameter specified. |
strerror_l (int errnum, locale_t locale) |
Obtains an error description string of the specified error code for the specified locale. |
strerror_r (int errnum, char buf, size_t buflen) |
Obtains an error description string of the specified error code. |
stpcpy (char dest, const char src) |
|
stpncpy (char dest, const char src, size_t n) |
|
strnlen (const char s, size_t maxlen) |
|
strdup (const char s) |
|
strndup (const char s, size_t n) |
|
strsignal (int sig) |
|
memccpy (void __restrict dest, const void __restrict src, int c, size_t n) |
|
strsep (char stringp, const char delim) |
Separates a string into a series of tokens separated by a delimiter. |
strlcat (char d, const char s, size_t n) |
|
strlcpy (char d, const char s, size_t n) |
|
strverscmp (const char s1, const char s2) |
Compares strings of two versions (string 1 and string 2) and returns the comparison result. |
strcasestr (const char haystack, const char needle) |
Searches for a needle string in its haystack string and returns a pointer. |
memmem (const void haystack, size_t haystacklen, const void needle, size_t needlelen) |
|
memrchr (const void s, int c, size_t n) |
|
mempcpy (void dest, const void src, size_t n) |
|
bcmp (const void s1, const void s2, size_t n) |
|
bcopy (const void src, void dest, size_t n) |
|
bzero (void s, size_t n) |
|
index (const char s, int c) |
Searches for the first position of the matched character in a string. |
rindex (const char s, int c) |
Searches for the last position of the matched character in a string. |
ffs (int i) |
|
ffsl (long int i) |
Searches for the first bit in a word of the long integer type. |
ffsll (long long int i) |
Searches for the first bit in a word of the 8-byte long integer type. |
strcasecmp (const char _l, const char _r) |
Compares two strings (string 1 and string 2), regardless of the letter case. |
strncasecmp (const char _l, const char _r, size_t n) |
Compares a specified length of two strings (string 1 and string 2), regardless of the letter case. |
pipe (int pipefd[2]) |
|
close (int fd) |
|
dup (int oldfd) |
|
dup2 (int oldfd, int newfd) |
Copies the descriptor of the target file to a specified descriptor. |
lseek (int fd, off_t offset, int whence) |
|
fsync (int fd) |
Synchronizes a file associated with a specified file descriptor to the storage device. |
read (int fd, void buf, size_t size) |
Reads the file contents and saves them in a specified buffer location. |
write (int fd, const void buf, size_t size) |
|
pread (int fd, void buf, size_t count, off_t offset) |
Reads data whose offset is offset and length is count from fd to the buffer. |
pwrite (int fd, const void buf, size_t count, off_t offset) |
Writes data from the buffer to fd whose offset is offset and length is count. |
unlink (const char path) |
|
unlinkat (int fd, const char path, int flag) |
|
rmdir (const char path) |
|
truncate (const char path, off_t length) |
Truncates a file to a specified size based on the file path. |
ftruncate (int fd, off_t length) |
|
access (const char path, int mode) |
|
chdir (const char path) |
Switches the current working directory to a specified directory. |
getcwd (char buf, size_t size) |
|
alarm (unsigned int seconds) |
Arranges a signal to be sent to the current process after the number of seconds specified by seconds. |
sleep (unsigned seconds) |
|
pause (void) |
|
fork (void) |
Creates a new process that inherits from the user-mode data of its parent process. |
execve (const char path, char const arg[], char const envp[]) |
|
execv (const char path, char const arg[]) |
|
execle (const char path, const char arg,…) |
|
execl (const char path, const char arg,…) |
|
execvp (const char path, char const arg[]) |
|
execlp (const char path, const char arg,…) |
|
_exit (int status) |
Exits the process immediately and closes all opened file descriptors in the process. |
swab (const void from, void to, ssize_t n) |
|
getpid (void) |
|
getppid (void) |
|
getpgrp (void) |
|
getpgid (pid_t pid) |
Obtains the ID of the process group whose process ID is specified by pid. |
setpgid (pid_t pid, pid_t pgid) |
Sets the ID of the process group whose process ID is specified by pid. |
getopt (int argc, char const argv[], const char optstring) |
Parses command-line arguments based on the specified option. |
getuid (void) |
|
geteuid (void) |
|
getgid (void) |
|
getegid (void) |
Obtains the effective group ID (GID) of the calling process. |
getgroups (int size, gid_t list[]) |
Obtains a list of supplementary user group IDs specific to the calling process. |
setuid (uid_t uid) |
|
seteuid (uid_t euid) |
|
setgid (gid_t gid) |
|
setegid (gid_t egid) |
|
pathconf (const char path, int name) |
|
setreuid (uid_t ruid, uid_t euid) |
Sets the real and effective user IDs of the calling process. |
setregid (gid_t rgid, gid_t egid) |
Sets the real and effective user group IDs of the calling process. |
setpgrp (void) |
|
usleep (unsigned useconds) |
|
ualarm (unsigned value, unsigned interval) |
|
setgroups (size_t size, const gid_t list) |
Sets the supplementary user group list of the calling process. |
setresuid (uid_t ruid, uid_t euid, uid_t suid) |
Sets the real, effective, and saved user IDs of the calling process. |
setresgid (gid_t rgid, gid_t egid, gid_t sgid) |
Sets the real, effective, and saved group IDs of the calling process. |
getresuid (uid_t ruid, uid_t euid, uid_t suid) |
Obtains the real, effective, and saved user IDs of the calling process. |
getresgid (gid_t rgid, gid_t egid, gid_t sgid) |
Obtains the real, effective, and saved user group IDs of the calling process. |
get_current_dir_name (void) |
|
sbrk (intptr_t increment) |
|
getpagesize (void) |
|
chown (const char pathname, uid_t owner, gid_t group) |
|
wcscpy (wchar_t dest, const wchar_t src) |
Copies the wide characters pointed to by src to the wide character array pointed to by dest, including the terminating null character ‘\0’. . |
wcsncpy (wchar_t dest, const wchar_t src, size_t n) |
Copies the first n wide characters pointed to by src to the wide character array pointed to by dest. |
wcscat (wchar_t dest, const wchar_t src) |
Appends a copy of the wide characters pointed to by src to the end of the wide character array pointed to by dest and adds a terminating null character ‘\0’. |
wcsncat (wchar_t dest, const wchar_t src, size_t n) |
Appends a copy of the first n wide characters pointed to by src to the end of the wide characters pointed to by dest and adds a terminating null character ‘\0’. |
wcscmp (const wchar_t s1, const wchar_t s2) |
Compares each character in the string pointed to by s1 with that in the string pointed to by s2 in ASCII-code order. |
wcsncmp (const wchar_t s1, const wchar_t s2, size_t n) |
Compares the first n characters in the string pointed to by s1 with those in the string pointed to by s2 in ASCII-code order. |
wcscoll (const wchar_t ws1, const wchar_t ws2) |
Compares the wide characters in the string pointed to by ws1 with those in the string pointed to by ws2 based on the specified locale LC_COLLATE. |
wcsxfrm (wchar_t s1, const wchar_t s2, size_t n) |
Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2. |
wcschr (const wchar_t wcs, wchar_t wc) |
Locates the first occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs. |
wcsrchr (const wchar_t wcs, wchar_t wc) |
Locates the last occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs. |
Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number of unmatched characters in wcs. |
|
Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number matched characters in wcs. |
|
Scans the wide character string pointed to by wcs for any wide characters specified in accept and obtains the first occurrence of the matched character. |
|
wcstok (wchar_t wcs, const wchar_t delim, wchar_t **ptr) |
Splits a wide character string pointed to by wcs into tokens using the given delimiter. |
wcslen (const wchar_t s) |
Calculates the length of a wide character string pointed to by s. |
wcswcs (const wchar_t haystack, const wchar_t needle) |
Searches the wide character string pointed to by dest for the first occurrence of the wide character string pointed to by src. |
wmemchr (const wchar_t s, wchar_t c, size_t n) |
Searches for the first position of the matched wide character within the specified number of characters in a wide character string. |
wmemcmp (const wchar_t lhs, const wchar_t rhs, size_t count) |
Compares the first count characters in the string pointed to by lhs with the first count characters in the string pointed to by rhs. |
wmemcpy (wchar_t dest, const wchar_t src, size_t count) |
Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest. |
wmemmove (wchar_t dest, const wchar_t src, size_t count) |
Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest (with possible array overlapping). |
wmemset (wchar_t dest, wchar_t ch, size_t count) |
Fills count characters specified by ch to the wide character array pointed to by dest. |
btowc (int c) |
Converts a single-byte character c into its wide-character representation. |
wctob (wint_t c) |
Converts a wide character c into its single-byte representation. |
mbsinit (const mbstate_t ps) |
Checks whether the mbstate_t object pointed to by ps is in the initial state. |
wcrtomb (char s, wchar_t wc, mbstate_t ps) |
Converts the wide character specified by wc into a character string and stores the string to the beginning of the character array pointed to by s. |
mbrlen (const char s, size_t n, mbstate_t ps) |
Determines the number of bytes in a character string pointed to by s. |
mbsrtowcs (wchar_t dest, const char src, size_t len, mbstate_t ps) |
Converts a multi-byte character string with a length of len into a wide character string. |
wcsrtombs (char dest, const wchar_t src, size_t len, mbstate_t ps) |
|
wcstof (const wchar_t str, wchar_t endptr) |
Converts a wide character string pointed to by str into a floating-point value and assigns the next character in str after the floating-point value to endptr. |
wcstod (const wchar_t *str, wchar_t endptr) |
Converts a wide character string pointed to by str into a double value and assigns the next character in str after the double value to endptr. |
wcstold (const wchar_t str, wchar_t **endptr) |
Converts a wide character string pointed to by str into a long double value and assigns the next character in str after the long double value to endptr. |
wcstol (const wchar_t str, wchar_t endptr, int base) |
Converts a wide character string pointed to by str into a long value. |
wcstoul (const wchar_t *str, wchar_t endptr, int base) |
Converts a wide character string pointed to by str into an unsigned long value of a specified base. |
wcstoll (const wchar_t str, wchar_t **endptr, int base) |
Converts a wide character string pointed to by str into a long long value of a specified base. |
wcstoull (const wchar_t str, wchar_t endptr, int base) |
Converts a wide character string pointed to by str into an unsigned long long value of a specified base. |
wprintf (const wchar_t format,…) |
|
swprintf (wchar_t wcs, size_t maxlen, const wchar_t format,…) |
|
vwprintf (const wchar_t format, va_list args) |
Prints formatted data from a variable argument list to the standard output (stdout). |
vfwprintf (FILE stream, const wchar_t *format, isoc_va_list args) |
Prints formatted data from a variable argument list specified by args to a specified file stream. |
vswprintf (wchar_t wcs, size_t maxlen, const wchar_t format, __isoc_va_list args) |
Prints formatted data from a variable argument list specified by args to a specified string. |
wscanf (const wchar_t format,…) |
Reads formatted data from the standard input (stdin) and stores it based on the wide string format into the locations pointed to by the variable arguments. |
Reads formatted data from a specified stream and stores it based on the wide string format into the locations pointed to by the variable arguments. |
|
swscanf (const wchar_t ws, const wchar_t format,…) |
Reads data from a wide character string pointed to by ws and stores it based on the wide string format into the locations pointed to by the variable arguments. |
vwscanf (const wchar_t format, va_list arg) |
Reads data from the stdin and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg. |
Reads data from a specified file stream and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg. |
|
vswscanf (const wchar_t ws, const wchar_t format, va_list arg) |
Reads data from a string pointed to by ws and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg. |
Reads the first wide character from a specified file stream. |
|
getwchar (void) |
|
putwchar (wchar_t wc) |
|
Writes a wide string pointed to by ws to a specified file stream. |
|
mbrtowc (wchar_t pwc, const char s, size_t n, mbstate_t ps) |
Converts a multi-byte character string with a length of n into a wide character string. |
mbsnrtowcs (wchar_t dest, const char src, size_t nwc, size_t len, mbstate_t ps) |
Converts a multi-byte character string with a length of n into a wide character string that can hold a total of nwc wide characters. |
wcsnrtombs (char dest, const wchar_t *src, size_t nwc, size_t len, mbstate_t ps) |
Converts nwc wide characters in the string pointed to by src into a character string. |
wcsdup (const wchar_t s) |
Copies a specified wide character string to a newly allocated buffer. |
wcsnlen (const wchar_t s, size_t maxlen) |
Calculates the length of a wide character string pointed to by s. |
wcpcpy (wchar_t dest, const wchar_t src) |
Copies the wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest. |
wcpncpy (wchar_t dest, const wchar_t src, size_t n) |
Copies n wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest. |
wcscasecmp (const wchar_t s1, const wchar_t s2) |
Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored. |
wcscasecmp_l (const wchar_t s1, const wchar_t s2, locale_t locale) |
Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored. |
wcsncasecmp (const wchar_t s1, const wchar_t s2, size_t n) |
Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored. |
wcsncasecmp_l (const wchar_t s1, const wchar_t s2, size_t n, locale_t locale) |
Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored. |
wcscoll_l (const wchar_t s1, const wchar_t s2, locale_t locale) |
Compares wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment. |
wcsftime (wchar_t restrict wcs, size_t n, const wchar_t *restrict f, const struct tm __restrict tm) |
Converts the date and time in the tm structure to a wide character string. |
wcsxfrm_l (wchar_t s1, const wchar_t s2, size_t n, locale_t locale) |
Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment. |
iswalnum (wint_t wc) |
|
iswalpha (wint_t wc) |
|
iswblank (wint_t wc) |
Checks whether a wide character is a space or tab character (\t). |
iswcntrl (wint_t wc) |
|
iswdigit (wint_t wc) |
|
iswgraph (wint_t wc) |
|
iswlower (wint_t wc) |
|
iswprint (wint_t wc) |
|
iswpunct (wint_t wc) |
|
iswupper (wint_t wc) |
|
iswxdigit (wint_t wc) |
|
iswctype (wint_t wc, wctype_t desc) |
Checks whether the character specified by wc belongs to the desc class. |
Translates the type of a wide character based on the conversion mapping relationship. |
|
towlower (wint_t wc) |
|
towupper (wint_t wc) |
|
wctrans (const char name) |
Determines a mapping which can map a wide character to another wide character. |
wctype (const char name) |
Checks whether a wide character type exists in the LC_CTYPE locale. |
iswalnum_l (wint_t wc, locale_t locale) |
Checks whether a wide character is a letter or digit for the specified locale. |
iswalpha_l (wint_t wc, locale_t locale) |
Checks whether a wide character is alphabetic for the specified locale. |
iswblank_l (wint_t wc, locale_t locale) |
Checks whether a wide character is a blank or \t character for the specified locale. |
iswcntrl_l (wint_t wc, locale_t locale) |
Checks whether a wide character is a control character for the specified locale. |
iswdigit_l (wint_t wc, locale_t locale) |
Checks whether a wide character is a decimal digit for the specified locale. |
iswgraph_l (wint_t wc, locale_t locale) |
Checks whether a wide character is visible for the specified locale. |
iswlower_l (wint_t wc, locale_t locale) |
Checks whether a wide character is in lowercase for the specified locale. |
iswprint_l (wint_t wc, locale_t locale) |
Checks whether a wide character is printable for the specified locale. |
iswpunct_l (wint_t wc, locale_t locale) |
Checks whether wc is a punctuation wide character for the specified locale. |
iswspace (wint_t wc) |
Checks whether a wide character belongs to the wide-character class space. |
iswspace_l (wint_t wc, locale_t locale) |
Checks whether a wide character belongs to the wide-character class space for the specified locale. |
iswupper_l (wint_t wc, locale_t locale) |
Checks whether a wide character is in uppercase for the specified locale. |
iswxdigit_l (wint_t wc, locale_t locale) |
Checks whether a wide character is a hexadecimal digit for the specified locale. |
iswctype_l (wint_t wc, wctype_t desc, locale_t locale) |
Checks whether the character specified by wc belongs to the desc class for the specified locale. |
towlower_l (wint_t wc, locale_t locale) |
Converts an uppercase wide character to lowercase for the specified locale. |
towupper_l (wint_t wc, locale_t locale) |
Converts a lowercase wide character to uppercase for the specified locale. |
towctrans_l (wint_t wc, wctype_t desc, locale_t locale) |
Translates the type of a wide character based on the translation mapping relationship for the specified locale. |
wctrans_l (const char name, locale_t locale) |
Determines a mapping which can map a wide character to another wide character. |
wctype_l (const char *name, locale_t locale) |
Checks whether a wide character type exists for the specified locale. |
Details
Macro Definition Documentation
_tolower
#define _tolower( a) ((a)|0x20)
Description:
Converts an uppercase letter to its lowercase equivalent.
Parameters:
a | Indicates the parameter to convert. |
Returns:
Returns the converted lowercase letter if the conversion is successful.
_toupper
#define _toupper( a) ((a)&0x5f)
Description:
Converts a lowercase letter to its uppercase equivalent.
Parameters:
a | Indicates the parameter to convert. |
Returns:
Returns the converted uppercase letter if the conversion is successful.
isascii
#define isascii( a) (0 ? isascii(a) : (unsigned)(a) < 128)
Description:
Checks whether a parameter is an ASCII character.
Parameters:
a | Indicates the parameter to check. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
strdupa
#define strdupa( x) [strcpy]($api-api-SmartVision-Devices-UTILS.md#ga7a82515b5d377be04817715c5465b647)(alloca([strlen]($api-api-SmartVision-Devices-UTILS.md#gaa383452fe445bfae989358c9d7d96f4f)(x)+1),x)
Description:
Copies a string to a new position.
Attention:
strdupa() internally calls alloca() to allocate space for variables. You should pay attention to the stack space size.
Returns:
Returns the pointer to the space allocated for the copied string if the operation is successful; returns NULL if the space fails to be allocated.
va_arg
#define va_arg( v, l ) __builtin_va_arg(v,l)
Description:
Obtains the next argument in the variable-length argument list.
Parameters:
v | Indicates the va_list v initialized by va_start(). Each call to va_arg() modifies v so that the next call returns the next argument. |
l | Indicates the name of the last argument before the variable argument list, that is, the last argument of which the calling function knows the type. |
Attention:
va_start must be called first.
va_copy
#define va_copy( d, s ) __builtin_va_copy(d,s)
Description:
Copies the previously initialized variable argument list s to d.
Parameters:
d | Indicates the destination variable. |
s | Indicates the source variable. |
va_end
#define va_end( v) __builtin_va_end(v)
Description:
Ends a variable-length argument list.
This function releases a calling function.
Parameters:
v | Indicates the va_list v initialized by va_start(). |
Attention:
After va_end is called, v is a random value.
va_start
#define va_start( v, l ) __builtin_va_start(v,l)
Description:
Defines the start position of the variable-length argument list.
This function initializes v for subsequent use by va_arg and va_end, and must be called first.
Parameters:
v | Indicates the argument to be initialized. |
l | Indicates the name of the last argument before the variable argument list, that is, the last argument of which the calling function knows the type. |
Attention:
This function must be used together with va_end.
Function Documentation
_Exit()
void _Exit (int status)
Description:
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.
Parameters:
status | Indicates the status sent to the parent process when the calling process ends. |
_exit()
_Noreturn void _exit (int status)
Description:
Exits the process immediately and closes all opened file descriptors in the process.
The subprocess is taken over by process 1.
Parameters:
status | Indicates the exit status of the process. The status is returned to the parent process of the current process and can be collected by the wait() series functions. |
a64l()
long a64l (const char * str64)
Description:
Converts between a 32-bit long integer and a little-endian 64-bit ASCII string.
Parameters:
str64 | Indicates the pointer to the character constant. |
Attention:
If the length of str64 is greater than 6, only the first six bytes are used.
Returns:
Returns the converted value.
abort()
_Noreturn void abort (void )
Description:
Terminates an abnormal process and sends the SIGABRT signal to the caller.
abs()
int abs (int i)
Description:
Obtains the absolute value of an integer value.
Parameters:
i | Indicates the integer value. |
Returns:
Returns the absolute value.
access()
int access (const char * path, int mode )
Description:
Checks whether a file has the corresponding permission.
Parameters:
path | Indicates the path of the file to be checked. |
mode | Indicates the access permission to be checked. |
Returns:
Returns 0 if the current file has the permission to be checked; returns -1 and sets errno to a value in the following table if the current file does not have the permission to be checked or other errors occur.
alarm()
unsigned int alarm (unsigned int seconds)
Description:
Arranges a signal to be sent to the current process after the number of seconds specified by seconds.
Parameters:
seconds | Indicates an unsigned integer seconds needs to be transferred. |
Attention:
An exception occurs when this function is used together with setitimer(), ualarm(), and sleep(). This function shares a timer with setitimer() and ualarm(). You are not advised to use this function together with sleep().
Returns:
Returns the remaining seconds until the countdown of seconds ends; returns 0 if no alarm clock is set.
assert()
void assert (scalar expression)
Description:
Aborts the program if assertion is false.
If the NDEBUG macro is not defined and the value of expression is false, an error message is displayed and the process is terminated. In other cases, this macro is expanded but no operation is performed.
Parameters:
expression | Indicates the condition variable. If the value of expression is false, an error message is displayed and the process is terminated. |
atexit()
int atexit (void(*)(void) func)
Description:
Registers a termination function.
The registered function is called when the current process is terminated normally. The sequence of the termination function to be called is opposite to the registration sequence.
Parameters:
func | Indicates the pointer to the termination function to be called. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
atof()
double atof (const char * nptr)
Description:
Converts an input string to a double-precision floating-point number.
The conversion stops when a non-numeric character is encountered.
Parameters:
nptr | Indicates the string to be converted. |
Returns:
Returns the converted value if the operation is successful; returns 0 if the operation fails.
atoi()
int atoi (const char * nptr)
Description:
Converts an input string to an integer.
The conversion stops when a non-numeric character is encountered.
Parameters:
nptr | Indicates the string to be converted. |
Returns:
Returns the converted value if the operation is successful; returns 0 if the operation fails.
atol()
long atol (const char * nptr)
Description:
Converts an input string to a long integer.
Parameters:
nptr | Indicates the string to be converted. |
Returns:
Returns the converted value if the operation is successful; returns 0 if the operation fails.
atoll()
long long atoll (const char * nptr)
Description:
Converts a string to an 8-byte long integer.
The conversion stops when a non-numeric character is encountered.
Parameters:
nptr | Indicates the string to be converted. |
Returns:
Returns the converted value if the operation is successful; returns 0 if the operation fails.
bcmp()
int bcmp (const void * s1, const void * s2, size_t n )
Description:
Compares byte sequences.
Specifically, this function checks whether the first n bytes of the two byte sequences pointed to by s1 and s2 are equal. If they are equal or n is 0, this function returns 0. Otherwise, it returns a non-zero value.
Parameters:
s1 | Indicates the pointer to byte sequence 1 for comparison. |
s2 | Indicates the pointer to byte sequence 2 for comparison. |
n | Indicates the number of bytes to be compared. |
Attention:
This function is deprecated (marked as LEGACY in POSIX.1-2001). Its specifications have been removed since POSIX.1-2008. You can use memcmp() in new projects.
Returns:
Returns 0 if the two byte sequences are equal or n is 0; returns a non-zero value if the operation fails.
bcopy()
void bcopy (const void * src, void * dest, size_t n )
Description:
Copies byte sequences.
Specifically, this function copies the first n bytes from the memory area pointed to by src to that pointed to by dest. This function can always be called successfully even if the two specified areas overlap.
Parameters:
src | Indicates the pointer to the source memory area. |
dest | Indicates the pointer to the destination memory area. |
n | Indicates the number of bytes to be copied. |
Attention:
This function is deprecated (marked as LEGACY in POSIX.1-2001). Its specifications have been removed since POSIX.1-2008. You can use memcpy() and memmove() in new projects.
bsearch()
void* bsearch (const void * key, const void * base, size_t nel, size_t width, int(*)(const void *, const void *) compar )
Description:
Searches for key using the binary search algorithm from the array element base[0] to base[num-1].
Parameters:
key | Indicates the pointer to the keyword to be searched. |
base | Indicates the array to be searched. |
nel | Indicates the number of elements in the array to be searched. |
width | Indicates the length of each element, in bytes. |
compare | Indicates the pointer to the comparison subfunction used to define comparison rules. |
Attention:
Data must have been sorted, following the same rule as the comparison subfunction pointed to by compar.
Returns:
Returns the matching item if the operation is successful; returns NULL if the operation fails.
btowc()
wint_t btowc (int c)
Description:
Converts a single-byte character c into its wide-character representation.
Parameters:
c | Indicates the character to be converted. |
Attention:
If c is EOF or its length is not 1, WEOF is returned.
Returns:
Returns the wide-character representation if the operation is successful; returns WEOF if c is EOF or its length is not 1.
bzero()
void bzero (void * s, size_t n )
Description:
Sets byte sequences to zero.
Specifically, this function sets the first n bytes in the memory area starting at s to zero.
Parameters:
s | Indicates the pointer to the first token in the byte sequence to be set to zero. |
n | Indicates the number of bytes to be set to zero. |
Attention:
This function is deprecated (marked as LEGACY in POSIX.1-2001). Its specifications have been removed since POSIX.1-2008. You can use memset() in new projects.
calloc()
void* calloc (size_t nmemb, size_t size )
Description:
Dynamically allocates nmemb memory blocks of size.
Parameters:
nmemb | Indicates the number of memory blocks to be allocated. |
size | Indicates the size of the memory block to be allocated. |
Returns:
Returns the pointer to the allocated memory block if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
chdir()
int chdir (const char * path)
Description:
Switches the current working directory to a specified directory.
Parameters:
path | Indicates the target working directory. |
Returns:
Returns 0 if the working directory is switched; returns -1 and sets errno to a value in the following table if the working directory fails to be switched and the current working directory remains unchanged.
The length of the path name is greater than PATH_MAX. |
|
chown()
int chown (const char * pathname, uid_t owner, gid_t group )
Description:
Changes the user and group ownership of a file.
Parameters:
pathname | Indicates the pointer to the file path. |
owner | Indicates the new file owner. |
group | Indicates the new file group. |
Attention:
This function can be used only in the JFFS2 file system.
Returns:
Returns 0 if the change is successful; returns -1 and sets errno to a value in the following table if the change fails.
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix directory. |
|
The length of the path name is greater than NAME_MAX. |
|
A component of the path prefix is the name of an existing file, which is neither a directory nor a symbolic link of a directory. |
|
The operation is not allowed or access is denied because the access is prohibited or the directory is full. |
|
close()
int close (int fd)
Description:
Closes a file with a specified file descriptor.
Parameters:
fd | Indicates the descriptor of the file to be closed. |
Returns:
Returns 0 if the file is closed; returns -1 and sets errno to a value in the following table if the file fails to be closed.
crypt()
char* crypt (const char * key, const char * setting )
Description:
Encrypts data.
This function converts the string to be encrypted to one-way hash data that can be stored in the user database.
Parameters:
key | Indicates the data to be encrypted. |
setting | Indicates the description of the encryption mode. The description consists of the encryption prefix and random characters, which are selected from (., /, 0-9, A-Z, a-z). The details are as follows: |
Attention:
The returned string is composed of printable ASCII characters, but does not contain spaces or any of the following characters: {‘:’, ‘;’, ‘*‘, ‘!’, ‘\‘}.
Returns:
Returns the encrypted data if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
div()
[div_t]($api-api-SmartVision-Devices-div_t.md) div (int numerator, int denominator )
Description:
Calculates the quotient and remainder of an integer after division.
Parameters:
numerator | Indicates the numerator. |
denominator | Indicates the denominator. |
Returns:
Returns a structure variable that has been defined in the function.
drand48()
double drand48 (void )
Description:
Obtains a random number.
This function returns a double-precision random number evenly distributed between (0.0, 1.0).
Attention:
Before calling this function, you need to call one of the initialization functions srand48(), seed48(), and lcong48().
Returns:
Returns the obtained double-precision random number.
dup()
int dup (int oldfd)
Description:
Copies a specified file descriptor.
Parameters:
oldfd | Indicates the file descriptor to be copied. |
Attention:
This function can be used only in the NFS file system.
Returns:
Returns a non-negative integer (minimum descriptor available to the current process) if the copy is successful; returns -1 and sets errno to a value in the following table if the copy fails.
Failed to allocate file descriptors because too many files are opened. |
|
The index node cannot be found based on the path name associated with oldfd. |
|
dup2()
int dup2 (int oldfd, int newfd )
Description:
Copies the descriptor of the target file to a specified descriptor.
Parameters:
oldfd | Indicates the file descriptor to be copied. |
newfd | Indicates the new file descriptor for copying. |
Returns:
Returns a non-negative integer (descriptor of the new file) if the copy is successful; returns -1 and sets errno to a value in the following table if the copy fails.
Failed to allocate file descriptors because too many files are opened. |
|
The index node cannot be found based on the path name associated with oldfd. |
|
ecvt()
char* ecvt (double number, int ndigits, int * decpt, int * sign )
Description:
Converts a double-precision floating-point number into a string.
The conversion result does not contain decimal places.
Parameters:
number | Indicates the double-precision floating-point number to be converted. |
ndigits | Indicates the number of valid digits to be stored. |
decpt | Indicates the decimal point position. |
sign | Indicates the symbol of the number to be converted. |
Returns:
Returns the pointer to the generated string.
erand48()
double erand48 (unsigned short xsubi[3])
Description:
Obtains a random number.
This function returns nonnegative double-precision floating-point values evenly distributed between [0.0, 1.0).
Parameters:
xsubi | Indicates the array of the initialized value of Xi. |
execl()
int execl (const char * path, const char * arg, ... )
Description:
Executes a specified user program file in ELF format.
Parameters:
path | Indicates the full path of the ELF file. |
arg | Indicates the list of parameters required by the program, ending with a null pointer. |
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails.
execle()
int execle (const char * path, const char * arg, ... )
Description:
Executes a specified user program file in ELF format.
Parameters:
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails.
execlp()
int execlp (const char * path, const char * arg, ... )
Description:
Executes a specified user program file in ELF format.
Parameters:
path | Indicates the name or path name of the program file to be executed. |
arg | Indicates the list of parameters required by the program, ending with a null pointer. |
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails. If the specified file name contains a slash (/), the file is executed. If it does not contain a slash (/), the current user program traverses the path list specified by the path environment variable. If the path environment variable is not defined, the current user program traverses (“/usr/local/bin:/bin:/usr/bin”). The path list and file name are combined as an executable file and the file is executed. If the file does not have the execute permission, the system continues to search for other path lists. If no other file is found, EACCES is returned. If no valid executable file exists in the list of all paths, -1 is returned.
execv()
int execv (const char * path, char *const arg[] )
Description:
Executes a specified user program file in ELF format.
Parameters:
path | Indicates the full path of the ELF file. |
arg | Indicates the list of program parameters maintained by the pointer to the array. The last element of the array must be a null pointer. |
Attention:
This function is slightly different from execve in input parameters. The arg parameter is a string array for storing new environment variables.
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails.
execve()
int execve (const char * path, char *const arg[], char *const envp[] )
Description:
Executes a specified user program file in ELF format.
Parameters:
path | Indicates the full path of the ELF file. |
arg | Indicates the list of program parameters maintained by the pointer to the array. The last element of the array must be a null pointer. |
envp | Indicates the pointer to the string for storing new environment variables. |
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails.
execvp()
int execvp (const char * path, char *const arg[] )
Description:
Executes a specified user program file in ELF format.
Parameters:
path | Indicates the name or path name of the program file to be executed. |
arg | Indicates the list of parameters required by the program, ending with a null pointer. |
Returns:
Returns -1 and sets errno to the corresponding error code perror if the operation fails. If the specified file name contains a slash (/), the file is executed. If it does not contain a slash (/), the current user program traverses the path list specified by the path environment variable. If the path environment variable is not defined, the current user program traverses (“/usr/local/bin:/bin:/usr/bin”). The path list and file name are combined as an executable file and the file is executed. If the file does not have the execute permission, the system continues to search for other path lists. If no other file is found, EACCES is returned. If no valid executable file exists in the list of all paths, -1 is returned.
exit()
void exit (int status)
Description:
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.
Parameters:
status | Indicates the status sent to the parent process when the calling process ends. |
fcvt()
char* fcvt (double number, int ndigits, int * decpt, int * sign )
Description:
Converts a floating-point number to a string.
Parameters:
Returns:
Returns the converted string.
ffs()
int ffs (int i)
Description:
Searches for the first bit in a word of the integer type.
Specifically, this function searches for the least significant bit (position 1) set in the word.
Parameters:
i | Indicates the long integer to be searched. |
Returns:
Returns the position of the first bit if the operation is successful; returns 0 if no bits are set in the word.
ffsl()
int ffsl (long int i)
Description:
Searches for the first bit in a word of the long integer type.
Specifically, this function searches for the least significant bit (position 1) set in the word.
Parameters:
i | Indicates the long integer to be searched. |
Returns:
Returns the position of the first bit if the operation is successful; returns 0 if no bits are set in the word.
ffsll()
int ffsll (long long int i)
Description:
Searches for the first bit in a word of the 8-byte long integer type.
Specifically, this function searches for the least significant bit (position 1) set in the word.
Parameters:
i | Indicates the 8-byte long integer to be searched. |
Returns:
Returns the position of the first bit if the operation is successful; returns 0 if no bits are set in the word.
fgetwc()
wint_t fgetwc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads a wide character from a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns the wide character if the operation is successful; returns WEOF if the operation fails or the end-of-file is reached during data reading.
fgetws()
wchar_t* fgetws (wchar_t * ws, int n, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Reads wide characters from a specified file stream.
Parameters:
ws | Indicates the pointer to the wide character array that stores the characters to read. |
n | Indicates the number of characters to read. |
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns the pointer to the read string if the operation is successful; returns a null pointer if no characters are read or the end-of-file is reached during data reading.
fmtmsg()
int fmtmsg (long classification, const char * label, int severity, const char * text, const char * action, const char * tag )
Description:
Prints formatted messages.
This function is used to print formatted messages to the output device specified by classification. The messages include the message definition, error severity, possible recovery steps, and reference to online documents.
Parameters:
classification | Indicates four types of information, including the output device, error source, problem detector, and problem severity. This parameter is of the long integer type. |
label | Indicates the pointer to the message source. This parameter consists of two fields separated by a colon (:). The first field is up to 10 characters, the second is up to 14 characters. |
severity | Indicates the severity level of an error message. For details, see MM_HALT, MM_ERROR, MM_WARNING, MM_INFO, and MM_NOOSEV. |
text | Indicates the condition of the error. |
action | Describes possible steps to recover from the error. |
tag | Indicates the referenced online documents where more information can be found. |
MM_PRINT, MM_CONSOLE or both |
|
Attention:
All parameters in this function can be ignored based on the following definitions: MM_NULLLBL, MM_NULLSEV, MM_NULLTXT, MM_NULLACT, and MM_NULLTAG.
Returns:
The function can return 4 values: MM_OK, MM_NOTOK, MM_NOMSG, and MM_NOCON.
fnmatch()
int fnmatch (const char * pattern, const char * string, int flags )
Description:
Matches a file name or a path name.
This function is used to check whether the value specified by string matches the value specified by pattern. Wildcards can be used in pattern, for example, ./foo* and foo*.boo*. You can use flags to set your required matching rule.
Parameters:
pattern | Indicates the pointer to the pattern to match. |
string | Indicates the pointer to the string to match against pattern. |
flags | Indicates a combination of flag bits that specify the matching rule. For details, see FNM_NOESCAPE, FNM_PATHNAME, FNM_PERIOD, FNM_LEADING_DIR, FNM_CASEFOLD, and FNM_FILE_NAME. |
Returns:
Returns 0 if the matching is successful; returns FNM_NOMATCH if the matching fails; returns a non-zero value if an error occurs.
fork()
pid_t fork (void )
Description:
Creates a new process that inherits from the user-mode data of its parent process.
Returns:
Returns 0 in the child process and returns the ID of the created child process in the parent process if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
fputwc()
wint_t fputwc (wchar_t wc, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a wide character wc to a specified file stream.
Parameters:
wc | Indicates the wide character to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns the wide character if the operation is successful; returns WEOF otherwise.
fputws()
int fputws (const wchar_t * ws, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a wide string pointed to by ws to a specified file stream.
Parameters:
ws | Indicates the pointer to the wide string to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns a non-negative value if the operation is successful; returns -1 (EOF) otherwise.
free()
void free (void * ptr)
Description:
Releases the memory space pointed to by ptr.
The memory space was allocated by using calloc(), malloc(), or realloc().
Parameters:
ptr | Indicates the pointer to the memory space to be released. |
fsync()
int fsync (int fd)
Description:
Synchronizes a file associated with a specified file descriptor to the storage device.
Parameters:
fd | Indicates the descriptor of the file to be synchronized. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
ftruncate()
int ftruncate (int fd, off_t length )
Description:
Truncates a file to a specified length.
Parameters:
fd | Indicates the file descriptor. |
length | Indicates the length of the file to be truncated. |
Attention:
This function can be used only in the FAT file system based on the file descriptor.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
Failed to obtain the file structure corresponding to the file specified by path, or the file access is rejected. |
fwide()
int fwide ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, int mode )
Description:
Sets and determines the orientation of the file stream.
Parameters:
Returns:
Returns a positive value if the stream is wide-oriented; returns a negative value if the stream is byte-oriented; returns 0 if the stream has no orientation.
fwprintf()
int fwprintf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) *__restrict fp, const wchar_t *__restrict fmt, ... )
Description:
Prints wide character strings to a specified file stream.
Parameters:
fp | Indicates the pointer to the stream to print data. |
fmt | Indicates the pointer to the output format of the data. |
Returns:
Returns the number of wide characters that are successfully printed; returns -1 if the operation fails.
fwscanf()
int fwscanf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const wchar_t * format, ... )
Description:
Reads formatted data from a specified stream and stores it based on the wide string format into the locations pointed to by the variable arguments.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
format | Indicates the pointer to the string that may contain the format specifiers. |
… | Indicates the variable arguments storing the input data. |
Returns:
Returns the number of variable arguments that are successfully stored.
gcvt()
char* gcvt (double x, int n, char * b )
Description:
Converts a floating-point number to a string.
Parameters:
x | Indicates the floating-point number to convert. |
n | Indicates the number of decimal places. |
b | Indicates the pointer to the output conversion result. |
Returns:
Returns the converted string.
get_current_dir_name()
char* get_current_dir_name (void )
Description:
Obtains the name of the current working directory.
Returns:
Returns the name of the current working directory if the operation is successful; returns NULL if the operation fails.
getcwd()
char* getcwd (char * buf, size_t size )
Description:
Obtains the current working directory.
Parameters:
buf | Indicates the pointer to the buffer of the array for storing the absolute path name of the current working directory. |
size | Indicates the size of the array to which the buffer points. |
Returns:
Returns buf if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
size is less than the length of the current working directory (including the terminating null byte \0). |
|
Failed to copy the name of the current working directory to the buffer using memcpy_s. |
getegid()
gid_t getegid (void )
Description:
Obtains the effective group ID (GID) of the calling process.
Returns:
Returns the effective GID.
getenv()
char* getenv (const char * name)
Description:
Obtains the value of an environment variable.
Parameters:
name | Indicates the pointer to the name of the environment variable whose value needs to be obtained. |
Returns:
Returns the pointer to the environment variable value if the operation is successful; returns NULL if there is no match.
geteuid()
uid_t geteuid (void )
Description:
Obtains the effective user ID (UID) of the calling process.
Returns:
Returns the effective UID.
getgid()
gid_t getgid (void )
Description:
Obtains the real group ID (GID) of the calling process.
Returns:
Returns the real GID.
getgroups()
int getgroups (int size, gid_t list[] )
Description:
Obtains a list of supplementary user group IDs specific to the calling process.
Parameters:
Returns:
Returns the number of supplementary groups of the calling process if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
getopt()
int getopt (int argc, char *const argv[], const char * optstring )
Description:
Parses command-line arguments based on the specified option.
Parameters:
Only characters that indicate different options are available. |
abc indicates that the file has three options -a, -b, and -c. |
b indicates that -b must be followed by an argument in the executable file that contains the getopt() function. |
|
b indicates that -b can be followed by or without the corresponding argument in the executable file that contains the getopt() function. |
Returns:
Returns the parsed option character if the parsing is successful; returns ? if an option character that is not in optstring is encountered during parsing. When an option is encountered but there is no argument during parsing, this function returns : if the first character of optstring is a colon (:); returns ? otherwise. Returns -1 in the following cases: if all options have been parsed or argv[optind] is a null pointer; if the first character of the string to which argv[optind] points is not -, that is, the non-option argv parameter cannot appear in the middle of the parameter list. If a non-option parameter is encountered during parsing, the parsing is terminated. if the string to which argv[optind] points is -.
getopt_long()
int getopt_long (int argc, char *const * argv, const char * optstring, const struct [option]($api-api-SmartVision-Devices-option.md) * longopts, int * longindex )
Description:
Parses the command-line arguments.
Parameters:
Only characters that indicate different options are available. |
abc indicates that the file has three options -a, -b, and -c. |
b indicates that -b must be followed by an argument in the executable file that contains the getopt() function. |
|
b indicates that -b can be followed by or without the corresponding argument in the executable file that contains the getopt() function. |
Returns:
Returns the parsed option character if the parsing is successful; returns -1 if all options have been parsed; returns ? if an option character that is not in optstring is encountered during parsing. When an option is encountered but there is no argument during parsing, this function returns : if the first character of optstring is a colon (:); returns ? otherwise.
getopt_long_only()
int getopt_long_only (int argc, char *const * argv, const char * optstring, const struct [option]($api-api-SmartVision-Devices-option.md) * longopts, int * longindex )
Description:
Parses the command-line arguments.
Parameters:
Only characters that indicate different options are available. |
abc indicates that the file has three options -a, -b, and -c. |
b indicates that -b must be followed by an argument in the executable file that contains the getopt() function. |
|
b indicates that -b can be followed by or without the corresponding argument in the executable file that contains the getopt() function. |
Attention:
Different from getopt_long, this function matches –name and -name as long arguments.
Returns:
Returns the parsed option character if the parsing is successful; returns -1 if all options have been parsed; returns ? if an option character that is not in optstring is encountered during parsing. When an option is encountered but there is no argument during parsing, this function returns : if the first character of optstring is a colon (:); returns ? otherwise.
getpagesize()
int getpagesize (void )
Description:
Obtains the memory page size.
Returns:
Returns the number of bytes in a memory page.
getpgid()
pid_t getpgid (pid_t pid)
Description:
Obtains the ID of the process group whose process ID is specified by pid.
Parameters:
pid | Indicates the process ID. If the value is 0, the process group ID of the current process is obtained. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
getpgrp()
pid_t getpgrp (void )
Description:
Obtains the ID of the process group of the calling process.
Returns:
Returns the process group ID if the operation is successful.
getpid()
pid_t getpid (void )
Description:
Obtains the process ID.
Returns:
Returns the process ID.
getppid()
pid_t getppid (void )
Description:
Obtains the parent process ID.
Returns:
Returns the parent process ID.
getresgid()
int getresgid (gid_t * rgid, gid_t * egid, gid_t * sgid )
Description:
Obtains the real, effective, and saved user group IDs of the calling process.
Parameters:
rgid | Indicates the pointer to the real user group ID. |
egid | Indicates the pointer to the effective user group ID. |
sgid | Indicates the pointer to the saved user group ID. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
getresuid()
int getresuid (uid_t * ruid, uid_t * euid, uid_t * suid )
Description:
Obtains the real, effective, and saved user IDs of the calling process.
Parameters:
ruid | Indicates the pointer to the real user ID. |
euid | Indicates the pointer to the effective user ID. |
suid | Indicates the pointer to the saved user ID. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
getsubopt()
int getsubopt (char ** optionp, char *const * tokens, char ** valuep )
Description:
Processes the parameters of an option in the command line.
Generally, this function is used together with the getopt() to process the parameters of an option. You are advised to use this function if the parameters of an option are complex.
Parameters:
optionp | Indicates the command word option. |
tokens | Indicates the pointer to the queried token. |
valuep | Indicates the suboption of the command word value. |
Returns:
Returns the index of the matched suboption element in tokens if the operation is successful; returns -1 if the operation fails. 1.0 1.0
getuid()
uid_t getuid (void )
Description:
Obtains the real user ID (UID) of the calling process.
Returns:
Returns the real UID.
getwc()
wint_t getwc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads the first wide character from a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function is similar to fgetwc except that it is implemented as a macro.
Returns:
Returns the wide character if the operation is successful; returns WEOF if an error occurs.
getwchar()
wint_t getwchar (void )
Description:
Reads a wide character from the stdin.
Attention:
For details about unlocked objects, see unlocked_stdio.
Returns:
Returns the wide character if the operation is successful; returns WEOF if an error occurs.
hcreate()
int hcreate (size_t nel)
Description:
Creates a hash table based on the number of entries.
Parameters:
nel | Indicates the maximum number of entries allowed in the hash table. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 and sets errno to a value if the operation fails.
hcreate_r()
int hcreate_r (size_t nel, struct [hsearch_data]($api-api-SmartVision-Devices-hsearch_data.md) * htab )
Description:
Creates a hash table based on the number of entries and its description.
Parameters:
nel | Indicates the maximum number of entries allowed in the hash table. |
htab | Indicates the hash table. |
Attention:
The hash table must be initialized before use.
Returns:
Returns a non-zero value if the operation is successful; returns 0 and sets errno to a value if the operation fails.
hdestroy()
void hdestroy (void )
Description:
Destroys a hash table.
This function releases the memory for creating a hash table.
hdestroy_r()
void hdestroy_r (struct [hsearch_data]($api-api-SmartVision-Devices-hsearch_data.md) * htab)
Description:
Destroys a hash table.
This function releases the memory occupied by the specified hash table.
Parameters:
htab | Indicates the hash table. |
hsearch()
[ENTRY]($api-api-SmartVision-Devices-UTILS.md#gaf609835b21489409e39a22ed20313ab8)* hsearch ([ENTRY]($api-api-SmartVision-Devices-UTILS.md#gaf609835b21489409e39a22ed20313ab8) item, ACTION action )
Description:
Adds or searches for a hash entry.
This function searches for the entry in the hash table based on the specified action. If the action is FIND, only the search action is performed. If the action is ENTER, an entry not found is added to the hash table.
Parameters:
Returns:
Returns the pointer to the hash table if the operation is successful.
hsearch_r()
int hsearch_r ([ENTRY]($api-api-SmartVision-Devices-UTILS.md#gaf609835b21489409e39a22ed20313ab8) item, ACTION action, [ENTRY]($api-api-SmartVision-Devices-UTILS.md#gaf609835b21489409e39a22ed20313ab8) ** retval, struct [hsearch_data]($api-api-SmartVision-Devices-hsearch_data.md) * htab )
Description:
Searches for a hash table.
This function searches for the entry in the hash table based on the specified action. If the action is FIND, only the search action is performed. If the action is ENTER, an entry not found is added to the hash table.
Parameters:
Returns:
Returns a non-zero value if the operation is successful; returns 0 if the operation fails.
imaxabs()
intmax_t imaxabs (intmax_t j)
Description:
Calculates the absolute value of an input parameter of the integer type.
This function is used to calculate the absolute value of the input parameter specified by j of the intmax_t type.
Parameters:
j | Indicates the input parameter. |
Attention:
Pay attention to the parameter type.
Returns:
Returns the absolute value of the input parameter if the operation is successful.
imaxdiv()
[imaxdiv_t]($api-api-SmartVision-Devices-imaxdiv_t.md) imaxdiv (intmax_t numerator, intmax_t denominator )
Description:
Calculates the quotient and remainder after the division operation is performed on an integer.
Parameters:
numerator | Indicates the numerator. |
denominator | Indicates the denominator. |
Returns:
Returns a structure variable that has been defined in the function.
index()
char* index (const char * s, int c )
Description:
Searches for the first position of the matched character in a string.
Parameters:
s | Indicates the pointer to the string to be searched. |
c | Indicates the character to be matched. |
Returns:
Returns the pointer to the matched character if the operation is successful; returns NULL if the operation fails.
initstate()
char* initstate (unsigned int seed, char * state, size_t n )
Description:
Initializes a random number generator.
This function initializes the state array for subsequent random use.
Parameters:
seed | Indicates the seed for initialization, which specifies the start point of the random number sequence and provides the information for restarting at the same point. |
Indicates | the state array used to generate random numbers. |
n | Indicates the length of the state array. |
Returns:
Returns the pointer to the state array if the operation is successful; returns NULL if the operation fails.
insque()
void insque (void * element, void * pred )
Description:
Adds an entry to a queue.
Parameters:
element | Indicates the element to be added to the queue. |
pred | After the position of prev to add the element. |
isalnum()
int isalnum (int c)
Description:
Checks whether a parameter is an alphabetic character or a decimal digit.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is an alphabetic character or a decimal digit; returns 0 otherwise.
isalnum_l()
int isalnum_l (int c, locale_t locale )
Description:
Checks whether a parameter is an alphabetic character or digit for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is an alphabetic character or digit; returns 0 otherwise.
isalpha()
int isalpha (int c)
Description:
Checks whether a parameter is an alphabetic character.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is an alphabetic character; returns 0 otherwise.
isalpha_l()
int isalpha_l (int c, locale_t locale )
Description:
Checks whether a parameter is an alphabetic character for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is an alphabetic character; returns 0 otherwise.
isblank()
int isblank (int c)
Description:
Checks whether a parameter is a blank character (space or tap).
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a blank character; returns 0 otherwise.
isblank_l()
int isblank_l (int c, locale_t locale )
Description:
Checks whether a parameter is a blank character (including spaces and tabs) for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a blank character; returns 0 otherwise.
iscntrl()
int iscntrl (int c)
Description:
Checks whether a parameter is a control character. A control character is invisible and does not occupy a printing position on a display.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a control character; returns 0 otherwise.
iscntrl_l()
int iscntrl_l (int c, locale_t locale )
Description:
Checks whether a parameter is a control character for the specified locale.
A control character is invisible and does not occupy a printing position on a display.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a control character; returns 0 otherwise.
isdigit()
int isdigit (int c)
Description:
Checks whether a parameter is a decimal digit (0-9).
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a decimal digit; returns 0 otherwise.
isdigit_l()
int isdigit_l (int c, locale_t locale )
Description:
Checks whether a parameter is a decimal digit for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a decimal digit; returns 0 otherwise.
isgraph()
int isgraph (int c)
Description:
Checks whether a parameter is any printable character except the space character.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a printable character except the space character; returns 0 otherwise.
isgraph_l()
int isgraph_l (int c, locale_t locale )
Description:
Checks whether a parameter is any printable character except the space character for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a printable character except the space character; returns 0 otherwise.
islower()
int islower (int c)
Description:
Checks whether a parameter is a lowercase letter.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a lowercase letter; returns 0 otherwise.
islower_l()
int islower_l (int c, locale_t locale )
Description:
Checks whether a parameter is a character of lowercase letters for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a lowercase letter; returns 0 otherwise.
isprint()
int isprint (int c)
Description:
Checks whether a parameter is a printable character (including space).
A printable character is a character that occupies a printing position on a display.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a printable character; returns 0 otherwise.
isprint_l()
int isprint_l (int c, locale_t locale )
Description:
Checks whether a parameter is a printable character (including space) for the specified locale. A printable character is visible and occupies a printing position on a display.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a printable character; returns 0 otherwise.
ispunct()
int ispunct (int c)
Description:
Checks whether a parameter is a punctuation or special character.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a punctuation or special character; returns 0 otherwise.
ispunct_l()
int ispunct_l (int c, locale_t locale )
Description:
Checks whether a parameter is a punctuation or special character for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a punctuation or special character; returns 0 otherwise.
isspace()
int isspace (int c)
Description:
Checks whether a parameter is a space character.
The space characters are: space, horizontal tab (\t), vertical tab (\v), form feed (\f), carriage return (\r), and line feed ( ).
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a space character; returns 0 otherwise.
isspace_l()
int isspace_l (int c, locale_t locale )
Description:
Checks whether a parameter is a blank character for the specified locale.
Blank characters refer to space, horizontal tab (\t), vertical tab (\v), form feed (\f), carriage return (\r), and line feed ( ).
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is a blank character; returns 0 otherwise.
isupper()
int isupper (int c)
Description:
Checks whether a parameter is an uppercase letter.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is an uppercase letter; returns 0 otherwise.
isupper_l()
int isupper_l (int c, locale_t locale )
Description:
Checks whether a parameter is a character of uppercase letters for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if c is in uppercase; returns 0 otherwise.
iswalnum()
int iswalnum (wint_t wc)
Description:
Checks whether a wide character is a letter or digit.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswalnum_l()
int iswalnum_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is a letter or digit for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswalpha()
int iswalpha (wint_t wc)
Description:
Checks whether a wide character is a letter.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswalpha_l()
int iswalpha_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is alphabetic for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswblank()
int iswblank (wint_t wc)
Description:
Checks whether a wide character is a space or tab character (\t).
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswblank_l()
int iswblank_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is a blank or \t character for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswcntrl()
int iswcntrl (wint_t wc)
Description:
Checks whether a wide character is a control character.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswcntrl_l()
int iswcntrl_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is a control character for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswctype()
int iswctype (wint_t wc, wctype_t desc )
Description:
Checks whether the character specified by wc belongs to the desc class.
Parameters:
wc | Indicates the wide character. |
desc | Indicates the wide character class. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswctype_l()
int iswctype_l (wint_t wc, wctype_t desc, locale_t locale )
Description:
Checks whether the character specified by wc belongs to the desc class for the specified locale.
Parameters:
wc | Indicates the wide character. |
desc | Indicates the wide character class. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswdigit()
int iswdigit (wint_t wc)
Description:
Checks whether a wide character is a decimal digit.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswdigit_l()
int iswdigit_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is a decimal digit for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswgraph()
int iswgraph (wint_t wc)
Description:
Checks whether a wide character is visible.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswgraph_l()
int iswgraph_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is visible for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswlower()
int iswlower (wint_t wc)
Description:
Checks whether a wide character is a lowercase letter.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswlower_l()
int iswlower_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is in lowercase for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswprint()
int iswprint (wint_t wc)
Description:
Checks whether a wide character is printable.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswprint_l()
int iswprint_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is printable for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswpunct()
int iswpunct (wint_t wc)
Description:
Checks whether a wide character is a punctuation mark.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswpunct_l()
int iswpunct_l (wint_t wc, locale_t locale )
Description:
Checks whether wc is a punctuation wide character for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswspace()
int iswspace (wint_t wc)
Description:
Checks whether a wide character belongs to the wide-character class space.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswspace_l()
int iswspace_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character belongs to the wide-character class space for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswupper()
int iswupper (wint_t wc)
Description:
Checks whether a wide character is an uppercase letter.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswupper_l()
int iswupper_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is in uppercase for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswxdigit()
int iswxdigit (wint_t wc)
Description:
Checks whether a wide character is a hexadecimal digit.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
iswxdigit_l()
int iswxdigit_l (wint_t wc, locale_t locale )
Description:
Checks whether a wide character is a hexadecimal digit for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the operation is successful; returns 0 otherwise.
isxdigit()
int isxdigit (int c)
Description:
Checks whether a parameter is a hexadecimal digit.
Parameters:
c | Indicates the parameter to check. |
Returns:
Returns a non-zero value if c is a hexadecimal digit; returns 0 otherwise.
isxdigit_l()
int isxdigit_l (int c, locale_t locale )
Description:
Checks whether a parameter is a hexadecimal digit for the specified locale.
Parameters:
c | Indicates the parameter to check. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns a non-zero value if the parameter is a hexadecimal digit; returns 0 otherwise.
jrand48()
long jrand48 (unsigned short xsubi[3])
Description:
Generates pseudo-random numbers evenly distributed between [-2^31, 2^31).
Parameters:
xsubi[3] | Indicates the array of the initialized value of Xi. |
Attention:
This function works by generating a 48-bit integer sequence, and X(i+1) must be generated by using the value of Xi. The correlation is obtained by using a linear congruential formula, Xn+1 = (aXn + c) mod m, where n = 0, m = 2^48, a = 0x5DEECE66D, and c = 0xB. Xi is specified by xsubi[3].
Returns:
Returns signed long integers evenly distributed between [-2^31, 2^31) if the operation is successful.
l64a()
char* l64a (long value)
Description:
Converts a long integer to a 64-bit ASCII string.
Parameters:
value | Indicates the long integer to be converted. |
Returns:
Returns the pointer to the static buffer if the operation is successful. The content in the buffer is overwritten each time the function is called. For multithreaded programs, this function returns a pointer to thread-specific data.
labs()
long labs (long i)
Description:
Calculates the absolute value of a long integer.
Parameters:
i | Indicates the long integer to be converted. |
Returns:
Returns the absolute value.
lcong48()
void lcong48 (unsigned short param[7])
Description:
Sets the seed and related algorithm parameters for the pseudo-random number generator.
Parameters:
param[7] | Indicates the parameters of the random number generator. |
Attention:
This function works by generating a 48-bit integer sequence, and X(i+1) must be generated by using the value of Xi. The correlation is obtained by using a linear congruential formula, Xn+1 = (aXn + c) mod m, where n = 0, m = 2^48, a = 0x5DEECE66D, and c = 0xB. param[0 - 2] is the initialized value of Xi. param [3-5] specifies the value of a, and param[6] specifies the value of c. After this function is called, calling srand48 () or seed48 () will restore the standard values of a and c.
ldiv()
[ldiv_t]($api-api-SmartVision-Devices-ldiv_t.md) ldiv (long numerator, long denominator )
Description:
Calculates the quotient and remainder of a long integer after division.
Parameters:
numerator | Indicates the numerator. |
denominator | Indicates the denominator. |
Returns:
Returns a structure variable that has been defined in the function.
lfind()
void* lfind (const void * key, const void * base, size_t * nelp, size_t width, int(*)(const void *, const void *) compar )
Description:
Performs a linear search for a key in the array.
Parameters:
key | Indicates the pointer to the key to be searched. |
base | Indicates the pointer to the array buffer. |
nelp | Indicates the pointer to the linear search length. |
width | Indicates the pointer to the array buffer width. |
compar | Indicates the pointer to the function to match. |
Returns:
Returns the obtained key if the operation is successful; returns NULL if the operation fails.
llabs()
long long llabs (long long i)
Description:
Calculates the absolute value of a long long integer.
Parameters:
i | Indicates the long long integer to be converted. |
Returns:
Returns the absolute value.
lldiv()
[lldiv_t]($api-api-SmartVision-Devices-lldiv_t.md) lldiv (long long numerator, long long denominator )
Description:
Calculates the quotient and remainder of a long long integer after division.
Parameters:
numerator | Indicates the numerator. |
denominator | Indicates the denominator. |
Returns:
Returns a structure variable that has been defined in the function.
lrand48()
long int lrand48 (void )
Description:
Generates pseudo-random numbers evenly distributed between [0, 2^31).
Attention:
This function works by generating a 48-bit integer sequence, and X(i+1) must be generated by using the value of Xi. The correlation is obtained by using a linear congruential formula, Xn+1 = (aXn + c) mod m, where n = 0, m = 2^48, a = 0x5DEECE66D, and c = 0xB. Before this function is called, one of the functions srand48(), seed48(), and lcong48() must be used to initialize Xi.
Returns:
Returns nonnegative long integers evenly distributed between [0, 2^31) if the operation is successful.
lsearch()
void* lsearch (const void * key, const void * base, size_t * nelp, size_t width, int(*)(const void *, const void *) compar )
Description:
Performs a linear search for a key in the array and adds a key to the end of the array if the key is not found.
Parameters:
key | Indicates the pointer to the key to be searched. |
base | Indicates the pointer to the array buffer. |
nelp | Indicates the pointer to the linear search length. |
width | Indicates the pointer to the array buffer width. |
compar | Indicates the pointer to the function to match. |
Returns:
Returns the obtained key if the operation is successful.
lseek()
off_t lseek (int fd, off_t offset, int whence )
Description:
Sets the offset of the pointer to the file.
The pointer to the file is used to read and write data.
Parameters:
Returns:
Returns the offset to the beginning of the file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
malloc()
void* malloc (size_t size)
Description:
Dynamically allocates a memory block of size.
The allocated memory is not initialized.
Parameters:
size | Indicates the size of the memory block to be allocated. |
Returns:
Returns the pointer to the allocated memory block if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
mblen()
int mblen (const char * s, size_t n )
Description:
Obtains the number of bytes in the next multi-byte string.
If s is not NULL, this function inspects at most n bytes of the multi-byte string starting at s.
Parameters:
s | Indicates the pointer to a string constant. |
n | Indicates the number of bytes to be checked. The value cannot be greater than MB_CUR_MAX. |
Returns:
Returns the number of bytes of the string constant if the operation is successful; returns 0 if the string constant content is a wide character that is empty; returns -1 if the string constant content is invalid or cannot be parsed.
mbrlen()
size_t mbrlen (const char * s, size_t n, mbstate_t * ps )
Description:
Determines the number of bytes in a character string pointed to by s.
If s is not NULL, this function checks at most n bytes in the string of s. It also uses a static anonymous shift state pointed to by ps.
Parameters:
s | Indicates the pointer to the string to check. |
n | Indicates the maximum number of bytes to check. |
ps | Indicates the pointer to the mbstate_t object describing the conversion state. |
Attention:
The behavior of this function depends on the LC_CTYPE type of the current locale.
Returns:
Returns the number of bytes in the string if the operation is successful. If s is a null pointer, this function returns 0. If the characters in s are invalid or cannot be parsed, this function returns -1. If the first n bytes in the string of s do not contribute to a complete multi-byte character, this function returns (size_t)-2. If the first n bytes in the string of s contain an invalid multi-byte character, this function returns (size_t)-1 and sets errno to EILSEQ.
mbrtowc()
size_t mbrtowc (wchar_t * pwc, const char * s, size_t n, mbstate_t * ps )
Description:
Converts a multi-byte character string with a length of n into a wide character string.
Parameters:
Returns:
Returns the number of characters written to the destination wide character array. If the first n bytes in the string of s do not contribute to a complete multi-byte character, this function returns (size_t)-2. If the first n bytes in the string of s contain an invalid multi-byte character, this function returns (size_t)-1 and sets errno to EILSEQ. If the converted wide character is L’\ 0’, this function returns 0 and resets * ps to the initial state.
mbsinit()
int mbsinit (const mbstate_t * ps)
Description:
Checks whether the mbstate_t object pointed to by ps is in the initial state.
Parameters:
ps | Indicates the pointer to the mbstate_t object to check. |
Returns:
Returns a non-zero value if ps points to an object that is in the initial state or it is a null pointer; returns 0 otherwise.
mbsnrtowcs()
size_t mbsnrtowcs (wchar_t * dest, const char ** src, size_t nwc, size_t len, mbstate_t * ps )
Description:
Converts a multi-byte character string with a length of n into a wide character string that can hold a total of nwc wide characters.
Parameters:
Attention:
The dest value cannot be NULL.
Returns:
Returns the number of characters written to the destination wide character array. If the first n bytes in the string of s contain an invalid multi-byte character, this function returns (size_t)-1 and sets errno to EILSEQ. If more than nwc characters will be written or more than len characters are to be converted, src points to the next character to be converted, and this function returns the number of characters successfully written to the destination wide character array. If the converted wide character is L’\ 0’, this function returns 0 and resets * ps to the initial state.
mbsrtowcs()
size_t mbsrtowcs (wchar_t * dest, const char ** src, size_t len, mbstate_t * ps )
Description:
Converts a multi-byte character string with a length of len into a wide character string.
Parameters:
Attention:
dest cannot be NULL.
Returns:
Returns the number of characters written to the destination wide character array. If an invalid character is encountered, this function returns len-1 and sets errno to EILSEQ. If len non-L’\0’ characters have been successfully written to the destination wide character array, src points to the next character to be converted, and this function returns the number of wide characters successfully written to the destination array. If the converted wide character is L’\0’, this function returns 0 and resets * ps to the initial state.
mbstowcs()
size_t mbstowcs (wchar_t * dest, const char * src, size_t n )
Description:
Converts a multi-byte string to a wide-character string.
Parameters:
Returns:
Returns the number of wide characters, excluding the terminating null wide character if the operation is successful; returns -1 if an invalid multibyte character is encountered.
mbtowc()
int mbtowc (wchar_t * pwc, const char * s, size_t n )
Description:
Converts a string constant to a wide character.
If s is not NULL, this function inspects at most n bytes of the multi-byte string starting at s and converts it to a wide character and stores it.
Parameters:
Attention:
s and pwc cannot be NULL. If s is NULL, pwc and n are ignored.
Returns:
Returns the number of bytes converted from s if the operation is successful; returns 0 if s points to an empty byte; returns -1 if the string constant content is invalid or cannot be parsed.
memccpy()
void* memccpy (void *__restrict dest, const void *__restrict src, int c, size_t n )
Description:
Copies a memory area to another one.
This function copies no more than n bytes from the source memory area pointed to by src to the destination memory area pointed to by dest. The copy stops when a character specified by c is found. The result for two overlapped memory areas is undefined.
Parameters:
dest | Indicates the pointer to the destination memory area. |
src | Indicates the pointer to the source memory area. |
c | Indicates the character for stopping copying. |
n | Indicates the size of the string to be copied, in bytes. |
Returns:
Returns the pointer to the next character of the character c in the destination memory area if the operation is successful; returns NULL if the character c is not found in the n bytes of the source memory area.
memchr()
void* memchr (const void * s, int c, size_t n )
Description:
Searches for a character in the specified memory area.
This function searches for the first occurrence of the character specified by c in the n-byte memory area pointed to by s. Both the character c and the memory area pointed to by s are interpreted as unsigned characters.
Parameters:
s | Indicates the pointer to the start of the bytes to be searched. |
c | Indicates the character to be searched for. |
n | Indicates the length of the memory area to be searched. |
Returns:
Returns the pointer to the character if found; returns NULL if no matching character is found.
memcmp()
int memcmp (const void * s1, const void * s2, size_t n )
Description:
Compares two memory areas.
This function checks whether the first n bytes of the two memory areas pointed to by s1 and s2 are equal.
Parameters:
s1 | Indicates the pointer to memory area 1 for comparison. |
s2 | Indicates the pointer to memory area 2 for comparison. |
n | Indicates the size of the memory area to be compared, in bytes. |
Returns:
Returns 0 if the first n bytes of two memory areas are the same or n is 0; returns the difference between the first pair of bytes that differ in s1 and s2 if the contents of two memory areas are different.
memcpy()
void* memcpy (void *__restrict dest, const void *__restrict src, size_t n )
Description:
Copies a string (overlapping not allowed).
This function copies n bytes from the source memory area pointed to by src to the destination memory area pointed to by dest. The two memory areas cannot overlap. If they overlap, use memmove() instead.
Parameters:
dest | Indicates the pointer to the destination memory area. |
src | Indicates the pointer to the source memory area. |
n | Indicates the size of the string to be copied, in bytes. |
Returns:
Returns the pointer (dest) to the destination memory area.
memmem()
void* memmem (const void * haystack, size_t haystacklen, const void * needle, size_t needlelen )
Description:
Searches for a needle string in its haystack string.
This function searches for the start position of the first occurrence of the needle string whose length is needlelen in the memory area holding the haystack string which starts at the position pointed to by haystack.
Parameters:
haystack | Indicates the pointer to the start position of the memory area to be searched. |
haystacklen | Indicates the length (in bytes) of the memory area to be searched. |
needle | Indicates the pointer to the start position of the needle string to be searched for. |
needlelen | Indicates the length (in bytes) of the needle string to be searched for. |
Attention:
This is an extended GNU function.
Returns:
Returns the start position of the needle string in the memory area if the position is found; returns NULL if the position is not found.
memmove()
void* memmove (void * dest, const void * src, size_t n )
Description:
Copies a string (overlapping allowed).
This function copies n bytes from the source memory area pointed to by src to the destination memory area pointed to by dest. The two memory areas can overlap.
Parameters:
dest | Indicates the pointer to the destination memory area. |
src | Indicates the pointer to the source memory area. |
n | Indicates the size of the string to be copied, in bytes. |
Returns:
Returns the pointer (dest) to the destination memory area.
See also:
mempcpy()
void* mempcpy (void * dest, const void * src, size_t n )
Description:
Copies a string (overlapping not allowed).
This function copies n bytes from the source memory area pointed to by src to the destination memory area pointed to by dest. The two memory areas cannot overlap. This function is similar to memcpy() except for the return value. This function returns the pointer to the last byte written during the copy.
Parameters:
dest | Indicates the pointer to the destination memory area. |
src | Indicates the pointer to the source memory area. |
n | Indicates the size of the string to be copied, in bytes. |
Returns:
Returns the pointer to the last byte written during the copy.
memrchr()
void* memrchr (const void * s, int c, size_t n )
Description:
Searches for a character in the specified memory area.
This function searches for the first occurrence of the character specified by c in the n-byte memory area pointed to by s. This function searches backward from the end of the n bytes pointed to by s, while the memchr() function searches forward from the beginning.
Parameters:
s | Indicates the pointer to the start of the bytes to be searched. |
c | Indicates the character to be searched for. |
n | Indicates the length of the memory area to be searched. |
Returns:
Returns the pointer to the character if found; returns NULL if no matching character is found.
memset()
void* memset (void * s, int c, size_t n )
Description:
Copies a character to the specified memory area.
This function copies the character specified by c to the n-byte memory area pointed to by s.
Parameters:
s | Indicates the pointer to the memory area to hold the character. |
c | Indicates the character to be copied. |
n | Indicates the size of the memory area. |
Returns:
Returns the pointer (s) to the memory area.
mkdtemp()
char* mkdtemp (char * template)
Description:
Creates a unique temporary directory based on template.
Parameters:
template | Indicates the name of the directory to be created. The last six characters must be XXXXXX. |
Returns:
Returns the pointer to the modified template string if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
For details, see mkdir. |
See also:
mkostemp()
int mkostemp (char * template, int flags )
Description:
Creates and opens a unique temporary file.
Different from mkstemp, this function has the flags parameter.
Parameters:
template | Indicates the name of the file to be created. The last six characters must be XXXXXX. |
flags | Indicates the flag for creating a file. For details, see open. |
Returns:
Returns the descriptor of the opened file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
For details, see open(). |
See also:
mkostemps()
int mkostemps (char * template, int suffixlen, int flags )
Description:
Creates and opens a unique temporary file.
Parameters:
template | Indicates the name of the file to be created. |
suffixlen | Indicates the length of the placeholder suffix XXXXXX. |
flags | Indicates the flag for creating a file. |
Returns:
Returns the descriptor of the opened file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The template length is less than (6 + suffixlen), or the last six characters of template are not XXXXXX. |
|
For details, see open(). |
See also:
mkstemp()
int mkstemp (char * template)
Description:
Creates and opens a unique temporary file.
Parameters:
template | Indicates the name of the file to be created. The last six characters must be XXXXXX. |
Returns:
Returns the descriptor of the opened file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
For details, see open(). |
See also:
mkstemps()
int mkstemps (char * template, int suffixlen )
Description:
Creates and opens a unique temporary file.
Parameters:
template | Indicates the name of the file to be created. |
suffixlen | Indicates the length of the placeholder suffix XXXXXX. |
Returns:
Returns the descriptor of the opened file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The template length is less than (6 + suffixlen), or the last six characters of template are not XXXXXX. |
|
For details, see open(). |
See also:
mktemp()
char* mktemp (char * template)
Description:
Creates a unique temporary file name.
Parameters:
template | Indicates the name of the file to be created. The last six characters are XXXXXX. |
Returns:
Returns the pointer to the created file name if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
mrand48()
long mrand48 (void )
Description:
Generates pseudo-random numbers evenly distributed between [-2^31, 2^31).
Attention:
This function works by generating a 48-bit integer sequence, and X(i+1) must be generated by using the value of Xi. The correlation is obtained by using a linear congruential formula, Xn+1 = (aXn + c) mod m, where n = 0, m = 2^48, a = 0x5DEECE66D, and c = 0xB. Before this function is called, one of the functions srand48(), seed48(), and lcong48() must be used to initialize Xi.
Returns:
Returns signed long integers evenly distributed between [-2^31, 2^31) if the operation is successful.
nrand48()
long int nrand48 (unsigned short xsubi[3])
Description:
Generates pseudo-random numbers evenly distributed between [0, 2^31).
Parameters:
xsubi[3] | Indicates the array of the initialized value of Xi. |
Attention:
This function works by generating a 48-bit integer sequence, and X(i+1) must be generated by using the value of Xi. The correlation is obtained by using a linear congruential formula, Xn+1 = (aXn + c) mod m, where n = 0, m = 2^48, a = 0x5DEECE66D, and c = 0xB. Xi is specified by xsubi[3].
Returns:
Returns nonnegative long integers evenly distributed between [0, 2^31) if the operation is successful.
pathconf()
long pathconf (const char * path, int name )
Description:
Obtains the configuration value of a file.
Parameters:
path | Indicates the file path. |
name | Indicates the name of the configuration value. |
Returns:
Returns the actual value of the configuration file if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The value of name does not match any existing configuration option. |
pause()
int pause (void )
Description:
Waits for signal.
This function is used to stop the current process or thread until a signal is delivered.
Returns:
Returns when a signal was caught and returns -1 and sets errno to EINTR.
pipe()
int pipe (int pipefd[2])
Description:
Creates an anonymous pipe.
Parameters:
Attention:
A maximum of 32 anonymous pipes can be created, and the internal buffer of a pipe is 1023 bytes.
Returns:
Returns 0 if the creation is successful; returns -1 and sets errno to a value in the following table if the creation fails.
Failed to create an anonymous pipe because the number of anonymous pipes has reached the upper limit. |
posix_memalign()
int posix_memalign (void ** memptr, size_t alignment, size_t size )
Description:
Allocates memory with the specified size based on the given alignment.
The value of alignment must be a power of 2 and a multiple of sizeof(void *). The allocated memory address is stored in *memptr. If size is 0, *memptr is either NULL or a unique pointer value that can later be successfully passed to free().
Parameters:
memptr | Indicates the double pointer to the allocated memory block. |
alignment | Indicates the alignment size of the allocated memory block. |
size | Indicates the size of the memory block to be allocated. |
Returns:
Returns 0 if the operation is successful; returns an error code if the operation fails.
The value of alignment is not a power of 2, or is not a multiple of sizeof(void *). |
|
pread()
ssize_t pread (int fd, void * buf, size_t count, off_t offset )
Description:
Reads data whose offset is offset and length is count from fd to the buffer.
Parameters:
fd | Indicates the file descriptor to read. |
buf | Indicates the pointer to the buffer for storing data. |
count | Indicates the length of the data to read. |
offset | Indicates the offset of the file descriptor to read. |
Attention:
The fd offset does not change after the function is called. This function is helpful in multithreaded applications. They allow multiple threads to execute the I/O on the same file descriptor without being affected by changes in other file offsets. It is not an error if the number of transferred bytes is less than the number of requested bytes after the function is called.
Returns:
Returns the number of records read if the operation is successful; returns -1 and sets errno to a value if the operation fails.
ptsname()
char* ptsname (int fd)
Description:
Obtains the name of a pseudo terminal.
Parameters:
fd | Indicates the terminal descriptor. |
Returns:
Returns the pointer to the name if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
putenv()
int putenv (char * s)
Description:
Configures an environment variable.
Parameters:
s | Indicates the content of the environment variable to configure. |
Returns:
Returns 0 if the operation is successful; returns -1 otherwise.
putwc()
wint_t putwc (wchar_t wc, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a wide character wc to a specified file stream.
Parameters:
wc | Indicates the wide character to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function is similar to fputwc only except that it is implemented as a macro.
Returns:
Returns the wide character if the operation is successful; returns WEOF otherwise.
putwchar()
wint_t putwchar (wchar_t wc)
Description:
Writes a wide character wc to the stdout.
Parameters:
wc | Indicates the wide character to write. |
Returns:
Returns the wide character if the operation is successful; returns WEOF otherwise.
pwrite()
ssize_t pwrite (int fd, const void * buf, size_t count, off_t offset )
Description:
Writes data from the buffer to fd whose offset is offset and length is count.
Parameters:
fd | Indicates the file descriptor to write. |
buf | Indicates the pointer to the buffer to which data is written. |
count | Indicates the size of the data to write. |
offset | Indicates the offset of the file to write. |
Attention:
The fd offset does not change after the function is called. This function is helpful in multithreaded applications. They allow multiple threads to execute the I/O on the same file descriptor without being affected by changes in other file offsets. It is not an error if the number of transferred bytes is less than the number of requested bytes after the function is called. For details, see write().
Returns:
Returns the number of records written if the operation is successful; returns -1 and sets errno to a value if the operation fails. Global variables of the int type can be directly obtained.
qsort()
void qsort (const void * base, size_t nel, size_t width, int(*)(const void *, const void *) compar )
Description:
Sorts array elements base[0] to base[num-1] based on the comparison rules of compar.
Parameters:
base | Indicates the array to be sorted. |
nel | Indicates the number of elements in the array to be searched. |
width | Indicates the length of each element, in bytes. |
compare | Indicates the pointer to the comparison subfunction used to define comparison rules. |
rand()
int rand (void )
Description:
Generates a pseudo-random number.
The random number ranges from 0 to RAND_MAX.
Attention:
RAND_MAX is defined in this header file. This function is implemented using the linear congruence method. If the random number seed does not change, the generated random number complies with the normal distribution. The generated random number is not a real random number but a pseudo-random number. Therefore, you need to use the srand() function to initialize the random number seed to the unique values.
Returns:
Returns a non-negative integer that is evenly distributed in the interval [0, RAND_MAX] if the operation is successful.
rand_r()
int rand_r (unsigned * seedp)
Description:
Generates a pseudo-random number.
The random number ranges from 0 to RAND_MAX.
Parameters:
seedp | Indicates the random number seed. |
Attention:
This function is implemented using the linear congruence method. If the random number seed does not change, the generated random number complies with the normal distribution. The generated random number is not a real random number but a pseudo-random number. Therefore, you need to use srand to initialize the random number seed to the unique values.
Returns:
Returns a non-negative integer that is evenly distributed in the interval [0, RAND_MAX] if the operation is successful.
random()
long int random (void )
Description:
Generates a pseudo-random number.
Attention:
Generally, srandom() is called before this function to generate a random number seed. If srandom() is not called or srandom(0) is used to generate a random number seed, the random number seed generated by srandom(1) is used.
read()
ssize_t read (int fd, void * buf, size_t size )
Description:
Reads the file contents and saves them in a specified buffer location.
Parameters:
fd | Indicates the descriptor of the file to read. |
buf | Indicates the pointer to the buffer for storing the data read. |
size | Indicates the length of the content to read. If the length exceeds that of the buffer, memory corruption may occur. |
Returns:
Returns the number of bytes read if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
realloc()
void* realloc (void * ptr, size_t size )
Description:
Changes the size of the memory block pointed to by ptr to size bytes.
The contents will remain unchanged in the range from the start of ptr to the minimum of the old and new sizes. If the new size is larger than the old size, the added memory will not be initialized. If ptr is NULL, this function call is equivalent to malloc(size); if size is equal to 0 and ptr is not NULL, the function call is equivalent to free(ptr). If ptr is not NULL, it must be the returned value of malloc(), calloc(), or realloc. If the memory block pointed to by ptr has been moved, free(ptr) is executed.
Parameters:
ptr | Indicates the pointer to the memory block to be adjusted. |
size | Indicates the new size of the memory block. |
Returns:
Returns the pointer to the new memory block if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
realpath()
char* realpath (const char *__restrict path, char *__restrict resolved )
Description:
Obtains a normalized absolute path.
Parameters:
path | Indicates the name of the absolute path to be obtained. |
resolved | Indicates the pointer to the obtained absolute path. |
Returns:
Returns the pointer to resolved_path if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
Read or search permission is denied on a component of the path prefix. |
|
Too many symbolic links are encountered when the path name is parsed. |
|
remque()
void remque (void * elem)
Description:
Removes an entry from a queue.
Parameters:
element | Indicates the element to be removed from the queue. |
rindex()
char* rindex (const char * s, int c )
Description:
Searches for the last position of the matched character in a string.
Parameters:
s | Indicates the pointer to the string to be searched. |
c | Indicates the character to be matched. |
Returns:
Returns the pointer to the matched character if the operation is successful; returns NULL if the operation fails.
rmdir()
int rmdir (const char * path)
Description:
Deletes a directory.
Parameters:
path | Indicates the name of the directory to be deleted. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The length of the path name is greater than PATH_MAX. |
|
The path is a mount point, or it is neither a directory nor a file. |
|
sbrk()
void* sbrk (intptr_t increment)
Description:
Adjusts the heap size of a process.
Parameters:
increment | Indicates the size of the memory space to obtain. |
Returns:
Returns the pointer to the memory space if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
secure_getenv()
char* secure_getenv (const char * name)
Description:
Obtains the value of an environment variable.
The feature of this function is the same as that of getenv() during non-secure execution.
Parameters:
name | Indicates the pointer to the name of the environment variable whose value needs to be obtained. |
Returns:
Returns the pointer to the environment variable value if the operation is successful; returns NULL if there is no match.
seed48()
unsigned short* seed48 (unsigned short [3])
Description:
Generates an evenly distributed pseudo-random seed.
Parameters:
seed16v | Indicates the 48-bit seed. |
Attention:
This function is an initialization function and can be called before calling drand48, lrand48, or mrand48.
Returns:
Returns the pointer to the pseudo-random seed.
setegid()
int setegid (gid_t egid)
Description:
Sets the effective user group ID of the calling process.
Parameters:
egid | Indicates the effective user group ID to set. |
Attention:
The real user group ID is the same as the effective user group ID and saved user group ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setenv()
int setenv (const char * name, const char * value, int overwrite )
Description:
Add or change an environment variable.
This function adds the varible name to environment with string value if name is not exist.
Parameters:
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails
The name is NULL, or its length is zero, or contains an “=” character. |
|
seteuid()
int seteuid (uid_t euid)
Description:
Sets the effective user ID of the calling process.
Parameters:
euid | Indicates the effective user ID to set. |
Attention:
The real user ID is the same as the effective user ID and saved user ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setgid()
int setgid (gid_t gid)
Description:
Sets the user group ID of the calling process.
Parameters:
gid | Indicates the user group ID to set. |
Attention:
The real user group ID is the same as the effective user group ID and saved user group ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setgroups()
int setgroups (size_t size, const gid_t * list )
Description:
Sets the supplementary user group list of the calling process.
Parameters:
size | Indicates the maximum size of the supplementary user group list. If the value is 0, the list is cleared. The maximum value is 255. |
list | Indicates the target supplementary group list. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setpgid()
int setpgid (pid_t pid, pid_t pgid )
Description:
Sets the ID of the process group whose process ID is specified by pid.
Parameters:
pid | Indicates the process ID. If the value is 0, the process group ID of the current process is obtained. |
pgid | Indicates the process group ID. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The child process has performed exec, and the parent process does not have the operation permission. |
setpgrp()
pid_t setpgrp (void )
Description:
Sets the process group ID of the calling process.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value if the operation fails.
setregid()
int setregid (gid_t rgid, gid_t egid )
Description:
Sets the real and effective user group IDs of the calling process.
Parameters:
Attention:
The real user group ID is the same as the effective user group ID and saved user group ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setresgid()
int setresgid (gid_t rgid, gid_t egid, gid_t sgid )
Description:
Sets the real, effective, and saved group IDs of the calling process.
Parameters:
Attention:
The real user group ID is the same as the effective user group ID and saved user group ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setresuid()
int setresuid (uid_t ruid, uid_t euid, uid_t suid )
Description:
Sets the real, effective, and saved user IDs of the calling process.
Parameters:
Attention:
The real user ID is the same as the effective user ID and saved user ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setreuid()
int setreuid (uid_t ruid, uid_t euid )
Description:
Sets the real and effective user IDs of the calling process.
Parameters:
Attention:
The real user ID is the same as the effective user ID and saved user ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setstate()
char* setstate (char * state)
Description:
Sets the current state list for subsequent random use.
Parameters:
state | Indicates the pointer to the state list. |
Returns:
Returns the pointer to the current state list if the operation is successful; returns NULL if the operation fails. errno is set to EINVAL if state is empty or the size of the state list is less than 8 bytes.
setuid()
int setuid (uid_t uid)
Description:
Sets the real user ID for the calling process.
Parameters:
uid | Indicates the user ID to set. |
Attention:
The real user ID is the same as the effective user ID and saved user ID.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
sleep()
unsigned sleep (unsigned seconds)
Description:
Sleeps for a period of time.
This function is used to stop the current thread until the specified time. A sleeping thread cannot be woken up by a signal.
Parameters:
seconds | Indicates the sleeping seconds. |
Returns:
Returns the seconds if the operation is successful; returns 0 and sets errno to a value in the following table if the operation fails.
srand()
void srand (unsigned int seed)
Description:
Initializes a random number generator.
Parameters:
seed | Indicates the seed for generating a pseudo-random number. |
Attention:
If seed is 0, this function is equivalent to srand(1). Before the rand() function is executed, this function is used to initialize different algorithm seeds to generate true random numbers.
srand48()
void srand48 (long int seedval)
Description:
Sets the start seed value for the pseudo-random number generator.
Parameters:
seedval | Indicates the 48-bit start seed value. |
Attention:
This function sets the high order 32 bits of Xi to seedval. The lower order 16 bits are set to 0x330E.
srandom()
void srandom (unsigned int seed)
Description:
Initializes a random number generator.
Parameters:
seed | Indicates the seed for generating a pseudo-random number. |
stpcpy()
char* stpcpy (char * dest, const char * src )
Description:
Copies a string.
This function copies the source string to the destination string and returns the pointer to the terminating null byte \0 of the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
Attention:
The null byte \0 in the source string is also copied to the destination string. The two strings cannot overlap. The destination string must be large enough to receive the copied string. You should be aware of a buffer overflow.
Returns:
Returns the pointer to the terminating null byte \0 of the destination string.
stpncpy()
char* stpncpy (char * dest, const char * src, size_t n )
Description:
Copies n characters of a string.
This function copies n characters of the source string to the destination string and returns the pointer to the terminating null byte \0 of the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
n | Indicates the number of characters to be copied. |
Attention:
The null byte \0 in the source string is also copied to the destination string. The two strings cannot overlap. The destination string must be large enough to receive the copied string. You should be aware of a buffer overflow. If the length of the source string is less than n, this function copies the null byte \0 to the destination string.
Returns:
Returns the pointer to the terminating null byte \0 of the destination string if the operation is successful; returns the pointer to the (dest+n) position if the destination string does not end with \0.
strcasecmp()
int strcasecmp (const char * _l, const char * _r )
Description:
Compares two strings (string 1 and string 2), regardless of the letter case.
Parameters:
_l | Indicates the pointer to string 1 for comparison. |
_r | Indicates the pointer to string 2 for comparison. |
Returns:
Returns 0 if the two strings are equal; returns a value greater than 0 if _l is greater than _r; returns a value less than 0 if _l is less than _r.
strcasestr()
char* strcasestr (const char * haystack, const char * needle )
Description:
Searches for a needle string in its haystack string and returns a pointer.
Parameters:
haystack | Indicates the pointer to the haystack string. |
needle | Indicates the pointer to the needle string. |
Attention:
The case difference is ignored during comparison.
Returns:
Returns the pointer to the beginning of the first needle string found in the haystack string if the operation is successful; returns NULL if the needle string is not found in the haystack string.
strcat()
char* strcat (char * dest, const char * src )
Description:
Appends a string to another one.
This function appends the source string to the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
Attention:
The null byte \0 of the destination string will be overwritten by the first byte of the source string. The destination string must have enough space for data storage. Otherwise, a buffer overflow may occur. If the destination string is not large enough, the program behavior will be unpredictable, and buffer overflows are the favorite choice for attacking secure programs.
Returns:
Returns the pointer to the destination string.
strchr()
char* strchr (const char * s, int c )
Description:
Locates the first occurrence of a character in a string.
Parameters:
s | Indicates the pointer to the string to be searched. |
c | Indicates the character to be searched for. |
Returns:
Returns the pointer to the position that the character appears for the first time in the string if the operation is successful; returns NULL if the character is not found in the string.
strcmp()
int strcmp (const char * s1, const char * s2 )
Description:
Compares two strings by characters.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
Attention:
The two strings are compared based on the ASCII code.
Returns:
Returns 0 if the operation is successful (the two strings are the same); returns the result of the ASCII character of string 1 minus the ASCII character of string 2 if the first pair of characters is at different positions in string 1 and string 2.
strcoll()
int strcoll (const char * s1, const char * s2 )
Description:
Compares two strings by character for the program’s current locale.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
Attention:
By default, the program’s current locale specified by LC_COLLATE is POSIX or C.
Returns:
Returns 0 if the operation is successful (the two strings are the same); returns an integer less than 0 if the value of a character in string 1 is less than the value of the corresponding character in string 2 when the first unmatched character appears; returns an integer greater than 0 if the value of a character in string 1 is greater than the value of the corresponding character in string 2 when the first unmatched character appears.
strcoll_l()
int strcoll_l (const char * s1, const char * s2, locale_t locale )
Description:
Compares two strings by character for the specified locale.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
locale | Indicates the locale. This parameter is ignored currently |
Returns:
Returns 0 if the operation is successful (the two strings are the same); returns an integer less than 0 if the value of a character in string 1 is less than the value of the corresponding character in string 2 when the first unmatched character appears; returns an integer greater than 0 if the value of a character in string 1 is greater than the value of the corresponding character in string 2 when the first unmatched character appears.
strcpy()
char* strcpy (char * dest, const char * src )
Description:
Copies a string.
This function copies the source string pointed to by s to the destination string pointed to by s and returns the pointer to the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
Attention:
The terminating null byte \0 in the source string is also copied to the destination string. The two strings cannot overlap. The destination string must be large enough to receive the copied string. You should be aware of a buffer overflow.
Returns:
Returns the pointer to the destination string.
strcspn()
size_t strcspn (const char * s, const char * reject )
Description:
Obtains the length of the initial segment of a string that contains characters not in reject.
This function is used to determine whether the characters in the string pointed to by s are in the string pointed to by reject.
Parameters:
s | Indicates the pointer to the string to be retrieved. |
reject | Indicates the pointer to the string containing all unmatched characters. |
Returns:
Returns the total number of consecutive unmatched characters in the initial segment of the string pointed to by s if the operation is successful; returns the length of the string pointed to by s if its characters cannot be found in the string pointed to by reject.
strdup()
char* strdup (const char * s)
Description:
Copies a string to a new position.
Parameters:
s | Indicates the pointer to the string to be copied. |
Attention:
The memory space is dynamically allocated in the function. Therefore, when the returned string is not required, the allocated memory space needs to be released. Otherwise, memory leakage occurs.
Returns:
Returns the pointer to the memory space holding the copied string if the operation is successful; returns NULL if the memory space for the copied string is insufficient.
strerror()
char* strerror (int errnum)
Description:
Obtains an error description string of the specified error code.
This function queries the string representation of the error description matching the error code specified by errnum.
Parameters:
errnum | Indicates the error code. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table otherwise.
strerror_l()
char* strerror_l (int errnum, locale_t locale )
Description:
Obtains an error description string of the specified error code for the specified locale.
This function queries the string representation of the error description matching the error code specified by errnum.
Parameters:
errnum | Indicates the error code. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the appropriate error description string if the operation is successful; returns NULL and sets errno to a value in the following table otherwise.
The buffer is insufficient to contain the error description string. |
strerror_r()
char* strerror_r (int errnum, char * buf, size_t buflen )
Description:
Obtains an error description string of the specified error code.
This function queries the string representation of the error description matching the error code specified by errnum.
Parameters:
errnum | Indicates the error code. |
buf | Indicates the pointer to the buffer for storing the error description string. |
buflen | Indicates the length of the buf parameter. |
Returns:
Returns the appropriate error description string if the operation is successful; returns NULL and sets errno to a value in the following table otherwise.
The buffer is insufficient to contain the error description string. |
strfmon()
ssize_t strfmon (char * s, size_t max, const char * format, ... )
Description:
Converts a monetary value to a string.
This function formats the monetary parameters according to a specified format and saves the results as a string.
Parameters:
s | Indicates the pointer to the target string. |
max | Indicates the maximum length of the target string. |
format | Indicates the pointer to the format of the string. |
… | Indicates the parameters corresponding to the format. |
Attention:
For details about currency symbols, see lconv.
Returns:
Returns number of bytes stored in the target string, excluding the terminating null byte \0, if the operation is successful; returns -1 sets errno to E2BIG if the operation fails.
strlcat()
size_t strlcat (char * d, const char * s, size_t n )
Description:
Appends the first n bytes of a string to another one.
This function appends the first n bytes of the source string to the destination string.
Parameters:
d | Indicates the pointer to the destination string. |
s | Indicates the pointer to the source string. |
n | Indicates the number of characters to be copied from the source string. |
Attention:
The null byte \0 of the destination string will be overwritten by the first byte of the source string, and the source string will end with \0.
Returns:
Returns strlen(src) plus MIN(n, strlen(initial d)).
strlcpy()
size_t strlcpy (char * d, const char * s, size_t n )
Description:
Copies a string.
This function copies n bytes of the source string pointed to by s to the destination string pointed to by d.
Parameters:
d | Indicates the pointer to the destination string. |
s | Indicates the pointer to the source string. |
n | Indicates the number of characters to be copied from the source string. |
Attention:
If the value of n is the same as the length of the destination string, the last character of the destination string will be \0.
Returns:
Returns the length of the source string, excluding the null byte \0.
strlen()
size_t strlen (const char * s)
Description:
Calculates the length of a string.
The length of a string does not include the terminating null byte \0 of the string.
Parameters:
s | Indicates the pointer to the string. |
Returns:
Returns the string length.
strncasecmp()
int strncasecmp (const char * _l, const char * _r, size_t n )
Description:
Compares a specified length of two strings (string 1 and string 2), regardless of the letter case.
Parameters:
_l | Indicates the pointer to string 1 for comparison. |
_r | Indicates the pointer to string 2 for comparison. |
n | Indicates the string length to be compared. |
Returns:
Returns 0 if the two strings are equal; returns a value greater than 0 if _l is greater than _r; returns a value less than 0 if _l is less than _r.
strncat()
char* strncat (char * dest, const char * src, size_t n )
Description:
Appends the first n bytes of a string to another one.
This function appends the first n bytes of the source string to the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
n | Indicates the number of bytes to be appended. |
Attention:
The null byte \0 of the destination string will be overwritten by the first byte of the source string. The destination string must have enough space for data storage. Otherwise, a buffer overflow may occur. If the destination string is not large enough, the program behavior will be unpredictable, and buffer overflows are the favorite choice for attacking secure programs.
Returns:
Returns the pointer to the destination string.
strncmp()
int strncmp (const char * s1, const char * s2, size_t n )
Description:
Compares the first n characters of two strings.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
n | Indicates the number of characters for comparison. |
Attention:
The two strings are compared based on the ASCII code.
Returns:
Returns 0 if the operation is successful (the first n characters of the two strings are the same); returns the result of the ASCII character of string 1 minus the ASCII character of string 2 if the first pair of characters is at different positions in string 1 and string 2.
strncpy()
char* strncpy (char * dest, const char * src, size_t n )
Description:
Copies n characters of a string.
This function copies n bytes of the source string pointed to by src to the destination string pointed to by dest and returns the pointer to the destination string.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
n | Indicates the number of characters to be copied from the source string. |
Attention:
The null byte \0 in the source string is also copied to the destination string. The two strings cannot overlap. The destination string must be large enough to receive the copied string. You should be aware of a buffer overflow. If the length of the source string is less than n, this function copies the null byte \0 to the destination string.
Returns:
Returns the pointer to the destination string.
strndup()
char* strndup (const char * s, size_t n )
Description:
Copies n characters of a string to a new position.
Parameters:
s | Indicates the pointer to the string to be copied. |
n | Indicates the total number of characters to be copied. |
Attention:
The memory space is dynamically allocated in the function. Therefore, when the returned string is not required, the allocated memory space needs to be released. Otherwise, memory leakage occurs. If the string is longer than n, only n-1 characters are copied and a terminating null byte \0 is added.
Returns:
Returns the pointer to the memory space holding the copied string if the operation is successful; returns NULL if the memory space for the copied string is insufficient.
strnlen()
size_t strnlen (const char * s, size_t maxlen )
Description:
Calculates the length of a string.
The actual length of a string does not include the terminating null byte \0 of the string.
Parameters:
s | Indicates the pointer to the string. |
maxlen | Indicates the maximum length of the string. |
Returns:
Returns the actual length of the string if it is less than the maximum length specified by maxlen; returns the value of maxlen if the actual length is greater than the maximum length specified by maxlen.
strpbrk()
char* strpbrk (const char * s, const char * accept )
Description:
Searches for any of a set of characters in a string.
This function is used to determine whether the characters in the string pointed to by s are in the string pointed to by accept.
Parameters:
s | Indicates the pointer to the string to be searched. |
accept | Indicates the pointer to the string containing all matched characters. |
Returns:
Returns the pointer to a character in the string pointed to by s that first matches one of the characters in the string pointed to by accept if the operation is successful; returns NULL if no characters are found in the string pointed to by accept.
strrchr()
char* strrchr (const char * s, int c )
Description:
Locates the last occurrence of a character in a string.
Parameters:
s | Indicates the pointer to the string to be searched. |
c | Indicates the character to be searched for. |
Returns:
Returns the pointer to the position that the character appears for the last time in the string if the operation is successful; returns NULL if the character is not found in the string.
strsep()
char* strsep (char ** stringp, const char * delim )
Description:
Separates a string into a series of tokens separated by a delimiter.
The function starts from *stringp and checks whether the string matches a character in the string representing the delimiter. This operation is terminated by overwriting the delimiter with a null byte \0.
Parameters:
stringp | Indicates the pointer to the first token of the source string. |
delim | Indicates the pointer to the string representing the delimiter. |
Returns:
Returns the pointer to the first token; returns NULL if *stringp is NULL or the delimiter is not found in the source string.
strsignal()
char* strsignal (int sig)
Description:
Returns a string describing the signal number.
Parameters:
sig | Indicates the signal number to be parsed. |
Returns:
Returns the signal description associated with the specified signal number if the operation is successful; returns NULL or an unknown signal message for an invalid signal number if the operation fails.
strspn()
size_t strspn (const char * s, const char * accept )
Description:
Obtains the length of the initial segment of a string that contains characters in accept.
This function is used to determine whether the characters in the string pointed to by s are in the string pointed to by accept.
Parameters:
s | Indicates the pointer to the string to be retrieved. |
accept | Indicates the pointer to the string containing all matched characters. |
Returns:
Returns the total number of consecutive matched characters in the initial segment of the string pointed to by s if the operation is successful; returns 0 if its characters cannot be found in the string pointed to by accept.
strstr()
char* strstr (const char * haystack, const char * needle )
Description:
Searches for a needle string in its haystack string.
Parameters:
haystack | Indicates the pointer to the haystack string. |
needle | Indicates the pointer to the needle string. |
Attention:
The null byte \0 in the needle string is not searched for.
Returns:
Returns the pointer to the first occurrence of the needle string in the haystack string if the operation is successful; returns NULL if the needle string is not found in the haystack string.
strtod()
double strtod (const char * nptr, char ** endptr )
Description:
Converts a string to double.
This function skips the space characters, starts the conversion at a digit or a positive or negative sign, and ends at a non-digit or the terminating null byte ‘\0’. If the value of endptr is not NULL, the pointer to the character in nptr where the conversion is terminated due to an invalid condition is stored in endptr.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the double pointer to the first unrecognized character. |
Returns:
Returns the converted value.
strtof()
float strtof (const char * nptr, char ** endptr )
Description:
Converts an input string to a floating-point number.
This function skips the space characters, starts the conversion at a digit or a positive or negative sign, and ends at a non-digit or the terminating null byte ‘\0’. If the value of endptr is not NULL, the pointer to the character in nptr where the conversion is terminated due to an invalid condition is stored in endptr.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the double pointer to the first unrecognized character. |
Returns:
Returns the converted value if the operation is successful.
strtoimax()
intmax_t strtoimax (const char * str, char ** endptr, int base )
Description:
Parses a string to a value of the intmax_t type.
This function is used to convert the string pointed to by str to a value of the intmax_t type. If endptr is not a null pointer, the function also sets the value of endptr to point to the first character following the integer.
Parameters:
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns a floating-point number if the operation is successful; returns 0 if no conversion was performed; returns the positive or negative value of HUGE_VAL and sets errno to ERANGE if the value falls out of the floating-point number range.
strtok()
char* strtok (char * str, const char * delim )
Description:
Separates a string into a series of tokens separated by a delimiter.
Parameters:
Attention:
In each call of this function, the string is separated only once. You can call this function multiple times to separate the string into a set of tokens.
Returns:
Returns the pointer to the first token in the string if the operation is successful; returns NULL if no delimiter is found in the string.
strtok_r()
char* strtok_r (char * str, const char * delim, char ** saveptr )
Description:
Separates a string into a series of tokens separated by a delimiter, with the saveptr parameter specified.
Parameters:
Attention:
In each call of this function, the string is separated only once. You can call this function multiple times to separate the string into a set of tokens. saveptr is specified to maintain context between successive calls that parse the same string.
Returns:
Returns the pointer to the first token in the string if the operation is successful; returns NULL if no delimiter is found in the string.
strtol()
long strtol (const char * nptr, char ** endptr, int base )
Description:
Converts a string to a long integer according to the given base.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the first character that is unrecognized. |
base | Indicates the number system. |
Attention:
The value of base ranges from 2 to 36. If the value of base is 0, the decimal format is used for conversion. Otherwise, the hexadecimal format is used, or the octal format is used if the next character is 0 instead of 0x.
Returns:
Returns the converted value.
strtold()
long double strtold (const char * nptr, char ** endptr )
Description:
Converts a string to long double.
This function skips the space characters, starts the conversion at a digit or a positive or negative sign, and ends at a non-digit or the terminating null byte ‘\0’. If the value of endptr is not NULL, the pointer to the character in nptr where the conversion is terminated due to an invalid condition is stored in endptr.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the double pointer to the first unrecognized character. |
Returns:
Returns the converted value.
strtoll()
long long strtoll (const char * nptr, char ** endptr, int base )
Description:
Converts a string to a long long integer according to the given base.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the first character that is unrecognized. |
base | Indicates the number system. |
Attention:
The value of base ranges from 2 to 36. If the value of base is 0, the decimal format is used for conversion. Otherwise, the hexadecimal format is used, or the octal format is used if the next character is 0 instead of 0x.
Returns:
Returns the converted value.
strtoul()
unsigned long strtoul (const char * nptr, char ** endptr, int base )
Description:
Converts a string to an unsigned long integer according to the given base.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the first character that is unrecognized. |
base | Indicates the number system. |
Attention:
The value of base ranges from 2 to 36. If the value of base is 0, the decimal format is used for conversion. Otherwise, the hexadecimal format is used, or the octal format is used if the next character is 0 instead of 0x.
Returns:
Returns the converted value.
strtoull()
unsigned long long strtoull (const char * nptr, char ** endptr, int base )
Description:
Converts a string to an unsigned long long integer according to the given base.
Parameters:
nptr | Indicates the input string. |
endptr | Indicates the first character that is unrecognized. |
base | Indicates the number system. |
Attention:
The value of base ranges from 2 to 36. If the value of base is 0, the decimal format is used for conversion. Otherwise, the hexadecimal format is used, or the octal format is used if the next character is 0 instead of 0x.
Returns:
Returns the converted value.
strtoumax()
uintmax_t strtoumax (const char * str, char ** endptr, int base )
Description:
Parses a string to a value of the uintmax_t type.
This function is used to convert the string pointed to by str to a value of the uintmax_t type. If endptr is not a null pointer, the function also sets the value of endptr to point to the first character following the integer.
Parameters:
str | Indicates the pointer to the string to parse. |
endptr | Indicates the double pointer to the first character following the integer obtained from str. |
base | Indicates the conversion of number system. |
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns a floating-point number if the operation is successful; returns 0 if no conversion was performed; returns the positive or negative value of HUGE_VAL and sets errno to ERANGE if the value falls out of the floating-point number range; returns a value that is not greater than the smallest positive normalized number if the correct value causes an overflow.
strverscmp()
int strverscmp (const char * s1, const char * s2 )
Description:
Compares strings of two versions (string 1 and string 2) and returns the comparison result.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
Attention:
strcmp compares two strings based on the lexicographic order, while this function compares two strings based on the locale specified by LC_COLLATE.
Returns:
Returns any of the following values: Assuming that a difference is found at the xth character,
The values for the first n characters of string 1 and string 2 are the same. |
strxfrm()
size_t strxfrm (char * dest, const char * src, size_t n )
Description:
Converts the first n characters of the source string pointed to by src based on the program’s current locale specified by LC_COLLATE, and places them in the destination string pointed to by dest.
Parameters:
dest | Indicates the pointer to the destination string. |
src | Indicates the pointer to the source string. |
n | Indicates the maximum string space. |
Attention:
If the return value is greater than or equal to n, the content of the destination string is uncertain.
Returns:
Returns the number of bytes in the destination string (excluding the terminating null byte ‘\0’).
swab()
void swab (const void * from, void * to, ssize_t n )
Description:
Swaps bytes.
This function is used to copy n bytes from the from array to the to array, exchanging adjacent even and odd bytes.
Parameters:
from | source array. |
to | destination array. |
n | number of bytes. |
swprintf()
int swprintf (wchar_t * wcs, size_t maxlen, const wchar_t * format, ... )
Description:
Prints formatted data to a specified string.
Parameters:
wcs | Indicates the pointer to the destination string. |
maxlen | Indicates the maximum length of the destination string. |
format | Indicates the pointer to the format string that contains the formatted data. |
…. | Indicates the variable arguments written to the formatted data. |
Attention:
A maximum of maxlen-1 valid characters can be printed to the destination string.
Returns:
Returns the number of formatted characters (excluding the terminating null character ‘\0’) if the operation is successful; returns -1 if the operation fails.
swscanf()
int swscanf (const wchar_t * ws, const wchar_t * format, ... )
Description:
Reads data from a wide character string pointed to by ws and stores it based on the wide string format into the locations pointed to by the variable arguments.
Parameters:
ws | Indicates the pointer to the wide character string to read. |
format | Indicates the pointer to the format string that contains the formatted data. |
…. | Indicates the variable arguments specifying the data to store. |
Attention:
An asterisk ( * ) right after the percent symbol (such as %*d and %*s) in the format denotes that the value for the format will be read but will not be stored into a variable.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading.
tdelete()
void* tdelete (const void * key, void ** rootp, int(*)(const void *, const void *) compar )
Description:
Deletes a key from the binary tree.
Parameters:
Returns:
Returns the parent pointer to the deleted key if the operation is successful; returns NULL if the operation fails.
tdestroy()
void tdestroy (void * root, void(*)(void *nodep) free_node )
Description:
Releases all nodes in the binary tree.
Parameters:
root | Indicates the pointer to the root node of the binary tree to be released. |
free_node | Indicates the callback function each time when a node is released. |
tfind()
void* tfind (const void * key, void *const * rootp, int(*)(const void *, const void *) compar )
Description:
Searches for a key in the binary tree.
Parameters:
Returns:
Returns the parent pointer to the deleted key if the operation is successful; returns NULL if the operation fails.
toascii()
int toascii (int c)
Description:
Converts a parameter of the integer type to an ASCII code.
Parameters:
c | Indicates the parameter to convert. |
Attention:
The function clears all but the lower seven bits of c.
Returns:
Returns the ASCII code if the conversion is successful.
tolower()
int tolower (int c)
Description:
Converts an uppercase letter specified by c to its lowercase equivalent.
Parameters:
c | Indicates the parameter to convert. |
Returns:
Returns the converted letter if the conversion is successful; returns c otherwise.
tolower_l()
int tolower_l (int c, locale_t locale )
Description:
Converts an upper letter specified by c to its lowercase equivalent for the specified locale.
Parameters:
c | Indicates the parameter to convert. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the converted value if the conversion is successful; returns c unchanged otherwise.
toupper()
int toupper (int c)
Description:
Converts a lowercase letter specified by c to its uppercase equivalent.
Parameters:
c | Indicates the parameter to convert. |
Returns:
Returns the converted letter if the conversion is successful; returns c otherwise.
toupper_l()
int toupper_l (int c, locale_t locale )
Description:
Converts a lowercase letter specified by c to its uppercase equivalent for the specified locale.
Parameters:
c | Indicates the parameter to convert. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the converted value if the conversion is successful; returns c unchanged otherwise.
towctrans()
wint_t towctrans (wint_t wc, [wctrans_t]($api-api-SmartVision-Devices-UTILS.md#ga10b40cc6ecda73a91162017d2df251a3) desc )
Description:
Translates the type of a wide character based on the conversion mapping relationship.
Parameters:
wc | Indicates the wide character. |
desc | Indicates the mapping relationship, which can be obtained from wctrans(). |
Returns:
Returns the translated wide character if the operation is successful; returns WEOF if wc is WEOF.
towctrans_l()
wint_t towctrans_l (wint_t wc, wctype_t desc, locale_t locale )
Description:
Translates the type of a wide character based on the translation mapping relationship for the specified locale.
Parameters:
wc | Indicates the wide character. |
desc | Indicates the mapping relationship, which can be obtained from wctrans_l(). |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the translated wide character if the operation is successful; returns WEOF if wc is WEOF.
towlower()
wint_t towlower (wint_t wc)
Description:
Converts an uppercase wide character to lowercase.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns the lowercase wide character if the conversion is successful; returns wc unchanged otherwise.
towlower_l()
wint_t towlower_l (wint_t wc, locale_t locale )
Description:
Converts an uppercase wide character to lowercase for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the lowercase wide character if the conversion is successful; returns wc unchanged otherwise. 1.0 1.0
towupper()
wint_t towupper (wint_t wc)
Description:
Converts a lowercase wide character to uppercase.
Parameters:
wc | Indicates the wide character. |
Returns:
Returns the uppercase wide character if the conversion is successful; returns wc unchanged otherwise.
towupper_l()
wint_t towupper_l (wint_t wc, locale_t locale )
Description:
Converts a lowercase wide character to uppercase for the specified locale.
Parameters:
wc | Indicates the wide character. |
locale | Indicates the locale. This parameter is ignored currently. |
Returns:
Returns the uppercase wide character if the conversion is successful; returns wc unchanged otherwise. 1.0 1.0
truncate()
int truncate (const char * path, off_t length )
Description:
Truncates a file to a specified size based on the file path.
Parameters:
path | Indicates the path of the file to be truncated. |
length | Indicates the length of the file to be truncated. |
Attention:
This function can be used only in the FAT file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
Failed to open the file because the length of path is greater than PATH_MAX. |
|
Failed to obtain the file structure corresponding to the file descriptor when opening the file. |
|
Failed to open the file because the maximum number of files that can be opened has been reached. |
|
Failed to obtain the file structure corresponding to the file specified by path, or the file access is rejected. |
tsearch()
void* tsearch (const void * key, void *const * rootp, int(*)(const void *, const void *) compar )
Description:
Searches for a key in the binary tree and adds a key to the tree if the key is not found.
Parameters:
twalk()
void twalk (const void * root, void(*)(const void *nodep, VISIT which, int depth) action )
Description:
Traverses a binary tree from left to right.
root points to the start node for the traversal. If the node is not the root, only part of the tree will be visited.
Parameters:
ualarm()
unsigned ualarm (unsigned value, unsigned interval )
Description:
Sets a microsecond-level timer.
Parameters:
value | Indicates the number of microseconds to be set for the timer. The precision unit is tick, and the deviation is ±1 tick. |
interval | Indicates the interval for triggering the timer. The precision unit is tick, and the deviation is ±1 tick. |
Returns:
Returns the remaining microseconds of the previous timer if the operation is successful; returns 0 if the operation fails.
ungetwc()
wint_t ungetwc (wint_t ch, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Pushes a character back into a specified file stream.
Parameters:
ch | Indicates the character to push back. |
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
If you call this function multiple times without any character inserting or reading operation or file stream repositioning, the calls will fail.
Returns:
Returns ch if the operation is successful; returns EOF otherwise.
unlink()
int unlink (const char * path)
Description:
Deletes a specified file.
Parameters:
path | Indicates the path of the file to be deleted. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The length of the path name is greater than NAME_MAX. |
|
The path is a pseudo file used as a directory, or the directory is not empty. |
|
The search permission on the path prefix component is denied, or the write permission of the directory in the path is denied. |
unlinkat()
int unlinkat (int fd, const char * path, int flag )
Description:
Deletes a specified file.
Parameters:
fd | Indicates the descriptor of the directory where the file to be deleted is located. Currently, this parameter can only be set to AT_FDCWD. |
path | Indicates the path of the file to be deleted. This parameter must be set to an absolute path. |
flag | Indicates the operation flag. The value can only be 0 (deleting a file) or AT_REMOVEDIR (deleting a directory, equivalent to rmdir). If this parameter is set to other values, the function will fail. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The length of the path name is greater than NAME_MAX. |
|
The path is a pseudo file used as a directory, or the directory is not empty. |
|
The search permission on the path prefix component is denied, or the write permission of the directory in the path is denied. |
unlockpt()
int unlockpt (int fd)
Description:
Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal.
Parameters:
fd | Indicates the primary terminal descriptor. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
unsetenv()
int unsetenv (const char * name)
Description:
Deletes an environment variable.
Parameters:
name | Indicates the name of environment variable to be deleted. if overwrite is zero, then the value of name remains unchanged. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails
usleep()
int usleep (unsigned useconds)
Description:
Sleeps for several microseconds.
This function is used to suspend the current thread for the specified duration. A sleeping thread cannot be woken up by a signal.
Parameters:
useconds | Indicates the sleeping time in microseconds. The precision unit is tick, and the deviation is less than 2 ticks. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
valloc()
void* valloc (size_t size)
Description:
Allocates memory with the specified size and aligns the allocated memory by page size.
Parameters:
size | Indicates the size of the memory block to be allocated. |
Returns:
Returns the pointer to the allocated memory block if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails and size is 0.
vfwprintf()
int vfwprintf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const wchar_t * format, __isoc_va_list args )
Description:
Prints formatted data from a variable argument list specified by args to a specified file stream.
Parameters:
Attention:
This function is generally used together with va_start and va_end and is the wide character equivalent of the vfprintf function.
Returns:
Returns the number of written characters (excluding the terminating null character ‘\0’) if the operation is successful; returns -1 if the operation fails.
vfwscanf()
int vfwscanf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const wchar_t * format, va_list arg )
Description:
Reads data from a specified file stream and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.
Parameters:
Attention:
This function is generally used together with va_start and va_end and is the wide character equivalent of the vfscanf function.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when wide characters are parsed, this function sets errno to EILSEQ.
vswprintf()
int vswprintf (wchar_t * wcs, size_t maxlen, const wchar_t * format, __isoc_va_list args )
Description:
Prints formatted data from a variable argument list specified by args to a specified string.
Parameters:
Attention:
The destination wide character string must end with the terminating null character ‘\0’. This function is generally used together with va_start and va_end and is the wide character equivalent of the vsnprintf function.
Returns:
Returns the number of written characters (excluding the terminating null character ‘\0’) if the operation is successful; returns -1 if the operation fails.
vswscanf()
int vswscanf (const wchar_t * ws, const wchar_t * format, va_list arg )
Description:
Reads data from a string pointed to by ws and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.
Parameters:
Attention:
This function is generally used together with va_start and va_end and is the wide character equivalent of the vsscanf function.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when wide characters are parsed, this function sets errno to EILSEQ.
vwprintf()
int vwprintf (const wchar_t * format, va_list args )
Description:
Prints formatted data from a variable argument list to the standard output (stdout).
Parameters:
format | Indicates the pointer to the string that may contain the format specifiers. |
args | Indicates a value identifying a variable argument list initialized by using va_start. |
Attention:
This function is generally used together with va_start and va_end and is the wide character equivalent of the vprintf function.
Returns:
Returns the total number of output characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
vwscanf()
int vwscanf (const wchar_t * format, va_list arg )
Description:
Reads data from the stdin and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.
Parameters:
format | Indicates the pointer to the string that may contain the format specifiers. |
arg | Indicates a value identifying a variable argument list initialized by using va_start. |
Attention:
This function is generally used together with va_start and va_end and is the wide character equivalent of the vscanf function.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when wide characters are parsed, this function sets errno to EILSEQ.
wcpcpy()
wchar_t* wcpcpy (wchar_t * dest, const wchar_t * src )
Description:
Copies the wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest.
Parameters:
dest | Indicates the pointer to the wide character array to copy the wide characters to. |
src | Indicates the pointer to the wide characters to copy. |
Attention:
Ensure that the array pointed to by dest has sufficient space to hold the wide characters to be written.
Returns:
Returns the pointer to the end of the destination wide character array.
wcpncpy()
wchar_t* wcpncpy (wchar_t * dest, const wchar_t * src, size_t n )
Description:
Copies n wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest.
Parameters:
dest | Indicates the pointer to the array to accommodate the copied wide characters. |
src | Indicates the pointer to the wide character string to be copied. |
n | Indicates the maximum number of wide characters to be copied. |
Attention:
Ensure that the array pointed to by dest has sufficient space to hold the wide characters to be written.
Returns:
Returns the pointer to the end of the destination wide character array.
wcrtomb()
size_t wcrtomb (char * s, wchar_t wc, mbstate_t * ps )
Description:
Converts the wide character specified by wc into a character string and stores the string to the beginning of the character array pointed to by s.
Parameters:
s | Indicates the pointer to the address storing the converted string. |
wc | Indicates the wide character to be converted. |
ps | Indicates the pointer to the mbstate_t object describing the conversion state. |
Returns:
Returns the number of characters written to the character string if the operation is successful; returns -1 and sets errno to EILSEQ if the operation fails.
wcscasecmp()
int wcscasecmp (const wchar_t * s1, const wchar_t * s2 )
Description:
Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wcscasecmp_l()
int wcscasecmp_l (const wchar_t * s1, const wchar_t * s2, locale_t locale )
Description:
Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
locale | Indicates the locale. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wcscat()
wchar_t* wcscat (wchar_t * dest, const wchar_t * src )
Description:
Appends a copy of the wide characters pointed to by src to the end of the wide character array pointed to by dest and adds a terminating null character ‘\0’.
Parameters:
dest | Indicates the pointer to the array to accommodate the concatenated wide characters. |
src | Indicates the pointer to the wide characters to be concatenated. |
Attention:
Ensure that the wide character array pointed to by dest has enough space to accommodate the concatenated characters (wcslen (dest) + wcslen (src) + 1).
Returns:
Returns the pointer to the destination string after concatenation.
wcschr()
wchar_t* wcschr (const wchar_t * wcs, wchar_t wc )
Description:
Locates the first occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs.
Parameters:
wcs | Indicates the pointer to the wide character string to match the specified wide character. |
wc | Indicates the wide character to be located. |
Returns:
Returns the pointer to the first occurrence of the wide character; returns NULL if no match is found in the wide character string.
wcscmp()
int wcscmp (const wchar_t * s1, const wchar_t * s2 )
Description:
Compares each character in the string pointed to by s1 with that in the string pointed to by s2 in ASCII-code order.
This comparison starts from the first character in the two strings.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
Returns:
Returns 0 if the two strings are equal; returns the result of subtracting the ASCII code of string 2 from the ASCII code of string 1 if the first mismatch is found.
wcscoll()
int wcscoll (const wchar_t * ws1, const wchar_t * ws2 )
Description:
Compares the wide characters in the string pointed to by ws1 with those in the string pointed to by ws2 based on the specified locale LC_COLLATE.
Parameters:
ws1 | Indicates the pointer to string 1 for comparison. |
ws2 | Indicates the pointer to string 2 for comparison. |
Attention:
By default, the program’s current locale specified by LC_COLLATE is POSIX or C.
Returns:
Returns 0 if the two strings are equal; returns the result of subtracting the ASCII code of string 2 from the ASCII code of string 1 if the first mismatch is found.
wcscoll_l()
int wcscoll_l (const wchar_t * s1, const wchar_t * s2, locale_t locale )
Description:
Compares wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
locale | Indicates the locale. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wcscpy()
wchar_t* wcscpy (wchar_t * dest, const wchar_t * src )
Description:
Copies the wide characters pointed to by src to the wide character array pointed to by dest, including the terminating null character ‘\0’. .
wcscspn()
size_t wcscspn (const wchar_t * wcs, const wchar_t * accept )
Description:
Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number of unmatched characters in wcs.
Parameters:
wcs | Indicates the pointer to the wide character string to be scanned. |
accept | Indicates the pointer to the wide characters to be matched with the string. |
Returns:
Returns the number of unmatched characters in wcs.
wcsdup()
wchar_t* wcsdup (const wchar_t * s)
Description:
Copies a specified wide character string to a newly allocated buffer.
Parameters:
s | Indicates the pointer to the wide character string to copy. |
Attention:
This function allocates memory for variables. It is best practice to release the memory if you do not use the returned wide character string.
Returns:
Returns the pointer to the new wide string buffer.
wcsftime()
size_t wcsftime (wchar_t *__restrict wcs, size_t n, const wchar_t *__restrict f, const struct [tm]($api-api-SmartVision-Devices-tm.md) *__restrict tm )
Description:
Converts the date and time in the tm structure to a wide character string.
Parameters:
Returns:
Returns the number of bytes in the string if the conversion is successful; returns 0 otherwise.
wcslen()
size_t wcslen (const wchar_t * s)
Description:
Calculates the length of a wide character string pointed to by s.
The length does not include the terminating null character ‘\0’.
Parameters:
s | Indicates the pointer to the wide character string to be calculated. This parameter cannot be NULL. |
Returns:
Returns the length of the string.
wcsncasecmp()
int wcsncasecmp (const wchar_t * s1, const wchar_t * s2, size_t n )
Description:
Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
n | Indicates the maximum number of wide characters to be compared. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wcsncasecmp_l()
int wcsncasecmp_l (const wchar_t * s1, const wchar_t * s2, size_t n, locale_t locale )
Description:
Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
n | Indicates the maximum number of wide characters to be compared. |
locale | Indicates the locale. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wcsncat()
wchar_t* wcsncat (wchar_t * dest, const wchar_t * src, size_t n )
Description:
Appends a copy of the first n wide characters pointed to by src to the end of the wide characters pointed to by dest and adds a terminating null character ‘\0’.
Parameters:
dest | Indicates the pointer to the array to accommodate the concatenated wide characters. |
src | Indicates the pointer to the wide characters to be concatenated. |
n | Indicates the maximum number of wide characters to be concatenated. |
Attention:
Ensure that the wide character array pointed to by dest has enough space to accommodate the concatenated characters (wcslen (dest) + n + 1).
Returns:
Returns the pointer to the destination string after concatenation.
wcsncmp()
int wcsncmp (const wchar_t * s1, const wchar_t * s2, size_t n )
Description:
Compares the first n characters in the string pointed to by s1 with those in the string pointed to by s2 in ASCII-code order.
Parameters:
s1 | Indicates the pointer to string 1 for comparison. |
s2 | Indicates the pointer to string 2 for comparison. |
n | Indicates the maximum number of characters to be compared. |
Attention:
If n is greater than the length of string 1 or string 2, the comparison stops when reaching the terminating null character L’\0’ for the first time.
Returns:
Returns 0 if the two strings are equal; returns the result of subtracting the ASCII code of string 2 from the ASCII code of string 1 if the first mismatch is found.
wcsncpy()
wchar_t* wcsncpy (wchar_t * dest, const wchar_t * src, size_t n )
Description:
Copies the first n wide characters pointed to by src to the wide character array pointed to by dest.
Parameters:
dest | Indicates the pointer to the array to accommodate the copied wide characters. |
src | Indicates the pointer to the wide characters to be copied. |
n | Indicates the maximum number of wide characters to be copied. |
Attention:
Ensure that the array pointed to by dest is large enough to accommodate the source characters. If the dest space is insufficient, unexpected exceptions may occur. Whenever a program reads data from or copies data to a buffer, it should first check whether there is enough space for the data. If the first n wide characters pointed to by src do not contain null characters, the character string copied to dest does not end with null.
Returns:
Returns the pointer to the destination string.
wcsnlen()
size_t wcsnlen (const wchar_t * s, size_t maxlen )
Description:
Calculates the length of a wide character string pointed to by s.
If the length of the string exceeds maxlen, maxlen is returned.
Parameters:
s | Indicates the pointer to the wide character string whose length is to be calculated. |
maxlen | Indicates the maximum length of the string whose length is to be calculated. |
Attention:
The length of the string does not include the terminating null character ‘\0’.
Returns:
Returns the length of the wide character string if the operation is successful; returns maxlen if the length of the string exceeds maxlen.
wcsnrtombs()
size_t wcsnrtombs (char * dest, const wchar_t ** src, size_t nwc, size_t len, mbstate_t * ps )
Description:
Converts nwc wide characters in the string pointed to by src into a character string.
Parameters:
Returns:
Returns the number of converted bytes, excluding the terminating null byte ‘\0’ if the operation is successful; returns -1 and sets errno to EILSEQ if the operation fails.
wcspbrk()
wchar_t* wcspbrk (const wchar_t * wcs, const wchar_t * accept )
Description:
Scans the wide character string pointed to by wcs for any wide characters specified in accept and obtains the first occurrence of the matched character.
Parameters:
wcs | Indicates the pointer to the wide character string to be scanned. |
accept | Indicates the pointer to the wide characters to be matched with the string. |
Returns:
Returns the pointer to the first occurrence of the matched character; returns NULL if no match is found.
wcsrchr()
wchar_t* wcsrchr (const wchar_t * wcs, wchar_t wc )
Description:
Locates the last occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs.
Parameters:
wcs | Indicates the pointer to the wide character string to match the specified wide character. |
wc | Indicates the wide character to be located. |
Returns:
Returns the pointer to the last occurrence of the wide character; returns NULL if no match is found in the wide character string.
wcsrtombs()
size_t wcsrtombs (char * dest, const wchar_t ** src, size_t len, mbstate_t * ps )
Description:
Converts a wide character string into a multi-byte string.
Parameters:
Returns:
Returns the number of converted bytes, excluding the terminating null byte ‘\0’ if the operation is successful; returns -1 and sets errno to EILSEQ if the operation fails.
wcsspn()
size_t wcsspn (const wchar_t * wcs, const wchar_t * accept )
Description:
Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number matched characters in wcs.
Parameters:
wcs | Indicates the pointer to the wide character string to be scanned. |
accept | Indicates the pointer to the wide characters to be matched with the string. |
Returns:
Returns the number of matched characters in wcs.
wcstod()
double wcstod (const wchar_t * str, wchar_t ** endptr )
Description:
Converts a wide character string pointed to by str into a double value and assigns the next character in str after the double value to endptr.
Parameters:
str | Indicates the pointer to the wide character string to be converted. |
endptr | Indicates the double pointer to the next character in str after the double value. |
Attention:
If the first character in str is a space, this function discards it until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE.
wcstof()
float wcstof (const wchar_t * str, wchar_t ** endptr )
Description:
Converts a wide character string pointed to by str into a floating-point value and assigns the next character in str after the floating-point value to endptr.
Parameters:
str | Indicates the pointer to the wide character string to be converted. |
endptr | Indicates the double pointer to the next character in str after the floating-point value. |
Attention:
If the first character in str is a space, this function discards it until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE.
wcstoimax()
intmax_t wcstoimax (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Parses a string to a value of the intmax_t type.
This function is used to convert the string pointed to by str to a value of the intmax_t type. If endptr is not a null pointer, the function also sets the value of endptr to point to the first character following the integer.
Parameters:
str | Indicates the pointer to the string to parse. |
endptr | Indicates the double pointer to the first character following the integer obtained from str. |
base | Indicates the conversion of number system. |
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns a floating-point number if the operation is successful; returns 0 if no conversion was performed; returns the positive or negative value of HUGE_VAL and sets errno to ERANGE if the value falls out of the floating-point number range; returns a value that is not greater than the smallest positive normalized number if the correct value causes an overflow.
wcstok()
wchar_t* wcstok (wchar_t * wcs, const wchar_t * delim, wchar_t ** ptr )
Description:
Splits a wide character string pointed to by wcs into tokens using the given delimiter.
Parameters:
Attention:
In each call to this function, the string is split only once. You can call this function multiple times to split the string into a set of tokens and use ptr to point to the rest part in the source string.
Returns:
Returns the pointer to the first token in the string if the operation is successful; returns NULL if no delimiter is found.
wcstol()
long wcstol (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Converts a wide character string pointed to by str into a long value.
Parameters:
Attention:
If the first character in str is a space, this function discards it until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE. If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.
wcstold()
long double wcstold (const wchar_t * str, wchar_t ** endptr )
Description:
Converts a wide character string pointed to by str into a long double value and assigns the next character in str after the long double value to endptr.
Parameters:
str | Indicates the pointer to the wide character string to be converted. |
endptr | Indicates the double pointer to the next character in str after the long double value. |
Attention:
If the first character in str is a space, this function discards it until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE.
wcstoll()
long long wcstoll (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Converts a wide character string pointed to by str into a long long value of a specified base.
Parameters:
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE. If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.
wcstombs()
size_t wcstombs (char * dest, const wchar_t * src, size_t n )
Description:
Converts a wide-character string to a multi-byte string.
Parameters:
Returns:
Returns the number of converted bytes, excluding the terminating null byte if the operation is successful; returns -1 and sets errno to EILSEQ if the operation fails.
wcstoul()
unsigned long wcstoul (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Converts a wide character string pointed to by str into an unsigned long value of a specified base.
Parameters:
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE. If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.
wcstoull()
unsigned long long wcstoull (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Converts a wide character string pointed to by str into an unsigned long long value of a specified base.
Parameters:
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns the converted value if the operation is successful. If no conversion can be performed, this function returns 0. If the correct value is out of the range of representable values for the type, this function returns a positive or negative HUGE_VAL and sets errno to ERANGE. If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.
wcstoumax()
uintmax_t wcstoumax (const wchar_t * str, wchar_t ** endptr, int base )
Description:
Parses a string to a value of the uintmax_t type.
This function is used to convert the string pointed to by str to a value of the uintmax_t type. If endptr is not a null pointer, the function also sets the value of endptr to point to the first character following the integer.
Parameters:
str | Indicates the pointer to the string to parse. |
endptr | Indicates the double pointer to the first character following the integer obtained from str. |
base | Indicates the conversion of number system. |
Attention:
This function discards as many spaces as possible until the first non-space character is found.
Returns:
Returns a floating-point number if the operation is successful; returns 0 if no conversion was performed; returns the positive or negative value of HUGE_VAL and sets errno to ERANGE if the value falls out of the floating-point number range; returns a value that is not greater than the smallest positive normalized number if the correct value causes an overflow.
wcswcs()
wchar_t * wcswcs (const wchar_t * haystack, const wchar_t * needle )
Description:
Searches the wide character string pointed to by dest for the first occurrence of the wide character string pointed to by src.
Searches for the first position of the matched wide character in a wide character string.
This match does not include the terminating null character ‘\0’.
ParametersParameters:
haystack | Indicates the pointer to the wide character string to be searched. |
needle | Indicates the pointer to the wide character string to match. |
haystack | Indicates the pointer to the wide character string to be searched. |
needle | Indicates the pointer to the wide character to be matched. |
Returns:
Returns the pointer to the first occurrence of the specified wide character string.
Returns:
Returns the pointer to the matched wide character if the operation is successful; returns NULL if the operation fails.
wcsxfrm()
size_t wcsxfrm (wchar_t * s1, const wchar_t * s2, size_t n )
Description:
Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
n | Indicates the maximum number of wide characters to be compared. |
Returns:
Returns 0 if the two strings are equal; returns a positive integer if s1 is greater than s2; returns a negative integer if s1 is less than s2.
wcsxfrm_l()
size_t wcsxfrm_l (wchar_t * s1, const wchar_t * s2, size_t n, locale_t locale )
Description:
Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment.
Parameters:
s1 | Indicates the pointer to wide character string 1 for comparison. |
s2 | Indicates the pointer to wide character string 2 for comparison. |
n | Indicates the maximum number of wide characters to be compared. |
locale | Indicates the locale. |
Returns:
Returns 0 if the two wide character strings are equal; returns the code difference between the two wide character strings if they are not equal.
wctob()
int wctob (wint_t c)
Description:
Converts a wide character c into its single-byte representation.
This function works only if the multi-byte character representation of this wide character c is a single-byte character in its initial state.
Parameters:
c | Indicates the wide character to be converted. |
Attention:
Use this function with caution. Internationalized programs should never distinguish between single-byte and multi-byte representations.
Returns:
Returns the converted single-byte representation if the operation is successful; returns EOF otherwise.
wctomb()
int wctomb (char * s, wchar_t wc )
Description:
Converts a wide character to its multi-byte sequence and stores it in a character array.
Parameters:
s | Indicates the pointer to an array that can store multi-byte characters. |
wc | Indicates the wide character to be converted. |
Returns:
Returns one of the following values:
A non-zero value if the code has shift state or 0 if the code is stateless. |
wctrans()
[wctrans_t]($api-api-SmartVision-Devices-UTILS.md#ga10b40cc6ecda73a91162017d2df251a3) wctrans (const char * name)
Description:
Determines a mapping which can map a wide character to another wide character.
In the LC_CTYPE locale, the mapping is returned based on the name parameter.
Parameters:
name | Indicates the mapping name. The value can only be tolower (converting an uppercase wide character to lowercase) or toupper (converting a lowercase wide character to uppercase). |
Returns:
Returns the mapping corresponding to name if the operation is successful; returns 0 otherwise.
wctrans_l()
[wctrans_t]($api-api-SmartVision-Devices-UTILS.md#ga10b40cc6ecda73a91162017d2df251a3) wctrans_l (const char * name, locale_t locale )
Description:
Determines a mapping which can map a wide character to another wide character.
In the LC_CTYPE locale, the mapping is returned based on the name parameter.
Parameters:
Returns:
Returns the mapping corresponding to name if the operation is successful; returns 0 otherwise.
wctype()
wctype_t wctype (const char * name)
Description:
Checks whether a wide character type exists in the LC_CTYPE locale.
Parameters:
name | Indicates the pointer to the wide character type. |
Attention:
The wide character types are as follows:
Returns:
Returns the type descriptor if the check is successful; returns 0 otherwise.
wctype_l()
wctype_t wctype_l (const char * name, locale_t locale )
Description:
Checks whether a wide character type exists for the specified locale.
Parameters:
name | Indicates the pointer to the wide character type. |
locale | Indicates the locale. This parameter is ignored currently. |
Attention:
The wide character types are as follows:
Returns:
Returns the type descriptor if the check is successful; returns 0 otherwise.
wmemchr()
wchar_t* wmemchr (const wchar_t * s, wchar_t c, size_t n )
Description:
Searches for the first position of the matched wide character within the specified number of characters in a wide character string.
Parameters:
s | Indicates the pointer to the wide character string to be searched. |
c | Indicates the wide character to be matched. |
n | Indicates the number of characters to be searched in the wide character string. |
Returns:
Returns the pointer to the matched wide character if the operation is successful; returns NULL if the operation fails.
wmemcmp()
int wmemcmp (const wchar_t * lhs, const wchar_t * rhs, size_t count )
Description:
Compares the first count characters in the string pointed to by lhs with the first count characters in the string pointed to by rhs.
Parameters:
lhs | Indicates the pointer to string 1 for comparison. |
rhs | Indicates the pointer to string 2 for comparison. |
count | Indicates the number of characters to compare. |
Attention:
This function compares character strings in lexicographical order. It is locale-insensitive and does not pay attention to the value of the wchar_t object. It does not stop comparison even when encountering a null or invalid wide character.
Returns:
Returns 0 if the first count characters of both strings are equal. If the wide character value of lhs is greater than that of rhs at the index (i) where the first mismatch is found, this function returns a value greater than 0. If the wide character value of lhs is less than that of rhs at the index (i) where the first mismatch is found, this function returns a value less than 0.
wmemcpy()
wchar_t* wmemcpy (wchar_t * dest, const wchar_t * src, size_t count )
Description:
Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest.
Parameters:
dest | Indicates the pointer to the wide character array to copy characters to. |
src | Indicates the pointer to the wide character array to copy characters from. |
count | Indicates the number of wide characters to copy. |
Attention:
If the arrays overlap (using the same memory), the behavior is undefined. If count is 0, this function does nothing.
Returns:
Returns the pointer to the destination string.
wmemmove()
wchar_t* wmemmove (wchar_t * dest, const wchar_t * src, size_t count )
Description:
Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest (with possible array overlapping).
Parameters:
dest | Indicates the pointer to the wide character array to copy characters to. |
src | Indicates the pointer to the wide character array to copy characters from. |
count | Indicates the number of wide characters to copy. |
Attention:
If count is 0, this function does nothing. The arrays may overlap. If the arrays overlap, a copying operation is triggered, as if wide characters were copied to a temporary wide character array and then copied from the temporary array to the array pointed to by dest.
Returns:
Returns the pointer to the destination string.
wmemset()
wchar_t* wmemset (wchar_t * dest, wchar_t ch, size_t count )
Description:
Fills count characters specified by ch to the wide character array pointed to by dest.
Parameters:
dest | Indicates the pointer to the wide character array to fill characters to. |
ch | Indicates the wide characters to be filled. |
count | Indicates the number of wide characters to be filled. |
Attention:
If count is 0, this function does nothing. This function is locale-insensitive and does not pay attention to the value of the wchar_t object, which can be null or an invalid wide character.
Returns:
Returns the pointer to the destination string.
wprintf()
int wprintf (const wchar_t * format, ... )
Description:
Prints formatted data to the standard output (stdout).
Parameters:
format | Indicates the pointer to the string that may contain the format specifiers. |
… | Indicates the variable arguments specifying the data to print. |
Attention:
This function is the wide character equivalent of the printf function.
Returns:
Returns the total number of output characters (excluding the terminating null character ‘\0’) if the operation is successful; returns -1 if the operation fails.
write()
ssize_t write (int fd, const void * buf, size_t size )
Description:
Writes the specified content to the file.
Parameters:
fd | Indicates the descriptor of the file into which content is to be written. |
buf | Indicates the pointer to the content to be written to the file. |
size | Indicates the length of the written data in the unit of bytes. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns the number of bytes written if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
wscanf()
int wscanf (const wchar_t * format, ... )
Description:
Reads formatted data from the standard input (stdin) and stores it based on the wide string format into the locations pointed to by the variable arguments.
Parameters:
format | Indicates the pointer to the string that may contain the format specifiers. |
… | Indicates the variable arguments specifying the data to read. |
Attention:
This function is the wide character equivalent of the scanf function.
Returns:
Returns the number of read bytes if the operation is successful; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when wide characters are parsed, this function sets errno to EILSEQ.