UTILS

    Since:

    1.0

    Version:

    1.0

    Summary

    Files

    Data Structures

    Data Structure Name

    Description

    Defines the command parsing option.

    imaxdiv_t

    Stores the division result.

    Defines a hash table entry.

    qelem

    Creates a queue from the doubly linked list for and remque.

    Defines a hash table.

    div_t

    Defines the structures of the division operation result.

    Defines the structures of the division operation result.

    lldiv_t

    Defines the structures of the division operation result.

    Macros

    Macro Name and Value

    Description

    BITS_PER_LONG    32

    Defines the number of bits of the long data type.

    EPERM    1

    Operation not permitted.

    ENOENT    2

    No such file or path.

    ESRCH    3

    No such process.

    EINTR    4

    Interrupted function call.

    EIO    5

    I/O error.

    ENXIO    6

    No such device or address.

    E2BIG    7

    Parameter list too long.

    ENOEXEC    8

    Exec format error.

    EBADF    9

    Bad file descriptor.

    ECHILD    10

    No child processes.

    EAGAIN    11

    Retry.

    ENOMEM    12

    Not enough memory space.

    EACCES    13

    Incorrect permission.

    EFAULT    14

    Invalid address.

    ENOTBLK    15

    Block device request.

    EBUSY    16

    Device or resource busy.

    EEXIST    17

    File exists.

    EXDEV    18

    Incorrect link.

    ENODEV    19

    No such device.

    ENOTDIR    20

    Not a directory.

    EISDIR    21

    Is a directory.

    EINVAL    22

    Invalid parameter.

    ENFILE    23

    Too many opened files in system (the maximum number exceeded)

    EMFILE    24

    Too many opened files in a process (the maximum number exceeded)

    ENOTTY    25

    Inappropriate I/O control operation.

    ETXTBSY    26

    Text file busy.

    EFBIG    27

    File too large.

    ENOSPC    28

    No space left on device.

    ESPIPE    29

    Invalid query.

    EROFS    30

    Read-only file system.

    EMLINK    31

    Too many links.

    EPIPE    32

    The pipe file is incorrect or the read end of the pipe is closed during the write operation.

    EDOM    33

    Domain error. The value of at least one input parameter is out of the parameter range.

    ERANGE    34

    The actual return value exceeds the return value range.

    EDEADLK    35

    Resource deadlock.

    ENAMETOOLONG    36

    File name too long.

    ENOLCK    37

    No locks available.

    ENOSYS    38

    Function not implemented.

    ENOTEMPTY    39

    Directory not empty.

    ELOOP    40

    Too many levels of symbolic links.

    EWOULDBLOCK    

    Operation would block (the same value as EAGAIN)

    ENOMSG    42

    No message of the desired type.

    EIDRM    43

    Identifier removed.

    ECHRNG    44

    Channel number out of range.

    EL2NSYNC    45

    Level 2 not synchronized.

    EL3HLT    46

    Level 3 halted.

    EL3RST    47

    Level 3 reset.

    ELNRNG    48

    Link ID out of range.

    EUNATCH    49

    Protocol driver not attached.

    ENOCSI    50

    No available CSI structure.

    EL2HLT    51

    Level 2 halted.

    EBADE    52

    Invalid exchange.

    EBADR    53

    Invalid request descriptor.

    EXFULL    54

    Exchange full.

    ENOANO    55

    No anode.

    EBADRQC    56

    Invalid request code.

    EBADSLT    57

    Invalid slot.

    EDEADLOCK    

    Resource deadlock (the same value as EDEADLK)

    EBFONT    59

    Incorrect font format.

    ENOSTR    60

    Not a stream device.

    ENODATA    61

    No message is available on the stream head read queue.

    ETIME    62

    Timer expired.

    ENOSR    63

    No stream resources.

    ENONET    64

    Machine is disconnected from the network.

    ENOPKG    65

    Package not installed.

    EREMOTE    66

    Object is remote.

    ENOLINK    67

    Link has been severed.

    EADV    68

    Broadcast error.

    ESRMNT    69

    srmount error

    ECOMM    70

    Communication error on send.

    EPROTO    71

    Protocol error.

    EMULTIHOP    72

    Multi-hop attempt.

    EDOTDOT    73

    RFS-specific error.

    EBADMSG    74

    Non-data message.

    EOVERFLOW    75

    Value too large to be represented by the defined data type.

    ENOTUNIQ    76

    Name not unique on the network.

    EBADFD    77

    File descriptor in the bad state.

    EREMCHG    78

    Remote address changed.

    ELIBACC    79

    Cannot access a needed shared library.

    ELIBBAD    80

    Accessing a corrupted shared library.

    ELIBSCN    81

    lib section in a.out corrupted

    ELIBMAX    82

    Attempting to link in too many shared libraries.

    ELIBEXEC    83

    Cannot execute a shared library directly.

    EILSEQ    84

    Invalid byte sequence.

    ERESTART    85

    Interrupted system call should be restarted.

    ESTRPIPE    86

    Stream pipe error.

    EUSERS    87

    Too many users.

    ENOTSOCK    88

    Not a socket.

    EDESTADDRREQ    89

    Destination address required.

    EMSGSIZE    90

    Message too long.

    EPROTOTYPE    91

    Socket protocol error.

    ENOPROTOOPT    92

    Protocol not available.

    EPROTONOSUPPORT    93

    Protocol not supported.

    ESOCKTNOSUPPORT    94

    Socket type not supported.

    EOPNOTSUPP    95

    Operation not supported on socket.

    ENOTSUP    

    Operation not supported on socket. The value is the same as that of EOPNOTSUPP.

    EPFNOSUPPORT    96

    Protocol family not supported.

    EAFNOSUPPORT    97

    Address family not supported.

    EADDRINUSE    98

    Address already in use.

    EADDRNOTAVAIL    99

    Address not available.

    ENETDOWN    100

    Network is down.

    ENETUNREACH    101

    Network unreachable.

    ENETRESET    102

    Network disconnection caused by restart.

    ECONNABORTED    103

    Network disconnection caused by software problems.

    ECONNRESET    104

    Connection reset.

    ENOBUFS    105

    No buffer space available.

    EISCONN    106

    Socket is connected.

    ENOTCONN    107

    Socket disconnected.

    ESHUTDOWN    108

    Cannot send after transport endpoint shutdown.

    ETOOMANYREFS    109

    Cannot splice due to too many references.

    ETIMEDOUT    110

    Connection timed out.

    ECONNREFUSED    111

    Connection refused.

    EHOSTDOWN    112

    Host is down.

    EHOSTUNREACH    113

    Host is unreachable.

    EALREADY    114

    Operation already in process.

    EINPROGRESS    115

    Operation in progress.

    ESTALE    116

    Stale file handle.

    EUCLEAN    117

    Structure needs cleaning.

    ENOTNAM    118

    Not a XENIX named type file.

    ENAVAIL    119

    No XENIX semaphores available.

    EISNAM    120

    Duplicate file name.

    EREMOTEIO    121

    Remote I/O error.

    EDQUOT    122

    Quota exceeded.

    ENOMEDIUM    123

    No medium found.

    EMEDIUMTYPE    124

    Wrong medium type.

    ECANCELED    125

    Operation canceled.

    ENOKEY    126

    Required key not available.

    EKEYEXPIRED    127

    Key has expired.

    EKEYREVOKED    128

    Key has been revoked.

    EKEYREJECTED    129

    Key was rejected by service.

    EOWNERDEAD    130

    Resource owner died.

    ENOTRECOVERABLE    131

    State not recoverable.

    ERFKILL    132

    Operation not possible due to RF-kill.

    EHWPOISON    133

    Hardware errors on the memory page.

    (a)   ((a)|0x20)

    Converts an uppercase letter to its lowercase equivalent.

    _toupper(a)   ((a)&0x5f)

    Converts a lowercase letter to its uppercase equivalent.

    (a)   (0 ? isascii(a) : (unsigned)(a) < 128)

    Checks whether a parameter is an ASCII character.

    MM_HARD    1

    A hardware error occurred.

    MM_SOFT    2

    A software error occurred.

    MM_FIRM    4

    A firmware error occurred.

    MM_APPL    8

    An error is detected by an application.

    MM_UTIL    16

    An error is detected by a utility.

    MM_OPSYS    32

    An error is detected by the operating system.

    MM_RECOVER    64

    The error is recoverable.

    MM_NRECOV    128

    The error is non-recoverable.

    MM_PRINT    256

    Prints error messages on standard error (stderr).

    MM_CONSOLE    512

    Prints error messages on the system console.

    MM_NULLMC    0L

    Ignores the classification parameter.

    MM_HALT    1

    Fatal fault.

    MM_ERROR    2

    Error-level fault.

    MM_WARNING    3

    Warning condition.

    MM_INFO    4

    Informative message.

    MM_NOSEV    0

    No severity level is set, equivalent to MM_NULLSEV.

    MM_OK    0

    The function succeeded.

    MM_NOTOK    (-1)

    The function failed.

    MM_NOMSG    1

    Error writing to stderr.

    MM_NOCON    4

    Error writing to the console.

    MM_NULLLBL    ((char)0)

    Ignores the label parameter.

    MM_NULLTXT    ((char)0)

    Ignores the text parameter.

    MM_NULLACT    ((char)0)

    Ignores the action parameter.

    MM_NULLTAG    ((char)0)

    Ignores the tag parameter.

    MM_NULLSEV    0

    Ignores the severity parameter.

    FNM_PATHNAME    0x1

    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.

    FNM_NOESCAPE    0x2

    If this flag is set, the backslash () is treated as an ordinary character, instead of an escape character.

    FNM_PERIOD    0x4

    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.

    FNM_LEADING_DIR    0x8

    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.

    FNM_CASEFOLD    0x10

    If this flag is set, the pattern is matched case-insensitively.

    FNM_FILE_NAME    

    The definition is similar to that of FNM_PATHNAME.

    FNM_NOMATCH    1

    The string parameter does not match the pattern parameter.

    FNM_NOSYS    (-1)

    The function does not support the operation.

    CHAR_MIN    0

    Minimum value of type char.

    CHAR_MAX    255

    Maximum value of type char.

    CHAR_BIT    8

    Number of bits in type char.

    SCHAR_MIN    (-128)

    Minimum value of type signed char.

    SCHAR_MAX    127

    Maximum value of type signed char.

    UCHAR_MAX    255

    Maximum value of type unsigned char.

    SHRT_MIN    (-1-0x7fff)

    Minimum value of type short.

    SHRT_MAX    0x7fff

    Maximum value of type short.

    USHRT_MAX    0xffff

    Maximum value of type unsigned short.

    INT_MIN    (-1-0x7fffffff)

    Minimum value of type int.

    INT_MAX    0x7fffffff

    Maximum value of type int.

    UINT_MAX    0xffffffffU

    Maximum value of type unsigned int.

    LONG_MAX    0x7fffffffL

    Maximum value of type long.

    LONG_MIN    (--1)

    Minimum value of type long.

    LONG_MAX    LONG_MAX

    Maximum value of type long.

    ULONG_MAX    (2UL+1)

    Maximum value of type unsigned long.

    LLONG_MIN    (-LLONG_MAX-1)

    Minimum value of type long long.

    LLONG_MAX    0x7fffffffffffffffLL

    Maximum value of type long long.

    ULLONG_MAX    (2ULL+1)

    Maximum value of type unsigned long long.

    PIPE_BUF    4096

    Buffer length of pipe.

    NAME_MAX    255

    Maximum length of file or directory name.

    PATH_MAX    256

    Maximum length of the whole file or directory path.

    ARG_MAX    4096

    Maximum length of parameter arg.

    IOV_MAX    1024

    Maximum vector number.

    WORD_BIT    32

    Number of bits in word.

    SSIZE_MAX    LONG_MAX

    Maximum value of type ssize_t.

    HOST_NAME_MAX    255

    Maximum length of host name.

    LONG_BIT    32

    Number of bits in long.

    MQ_PRIO_MAX    1

    Maximum priority number of message queue.

    PAGESIZE    4096

    Page size.

    PAGE_SIZE    

    Page size.

    va_start(v, l)   builtin_va_start(v,l)

    Defines the start position of the variable-length argument list.

    (v)   builtin_va_end(v)

    Ends a variable-length argument list.

    va_arg(v, l)   builtin_va_arg(v,l)

    Obtains the next argument in the variable-length argument list.

    (d, s)   __builtin_va_copy(d,s)

    Copies the previously initialized variable argument list s to d.

    strdupa(x)   (alloca(strlen(x)+1),x)

    Copies a string to a new position.

    STDIN_FILENO    0

    Descriptor ID of the standard input file.

    STDOUT_FILENO    1

    Descriptor ID of the standard output file.

    STDERR_FILENO    2

    Descriptor ID of the standard error file.

    SEEK_SET    0

    Relocation starts from the file header.

    SEEK_CUR    1

    Relocation starts from the position of the currently accessed file.

    SEEK_END    2

    Relocation starts from the end of the file.

    NULL    ((void*)0)

    NULL.

    F_OK    0

    Existing file.

    R_OK    4

    Readable file.

    W_OK    2

    Writable file.

    X_OK    1

    Executable file.

    Typedefs

    Typedef Name

    Description

    ENTRY

    typedef struct  

    Defines a hash table entry.

    Functions

    Function Name

    Description

    crypt (const char key, const char setting)

    char  

    Encrypts data.

    (int c)

    int 

    Checks whether a parameter is an alphabetic character or a decimal digit.

    isalpha (int c)

    int 

    Checks whether a parameter is an alphabetic character.

    (int c)

    int 

    Checks whether a parameter is a blank character (space or tap).

    iscntrl (int c)

    int 

    Checks whether a parameter is a control character. A control character is invisible and does not occupy a printing position on a display.

    (int c)

    int 

    Checks whether a parameter is a decimal digit (0-9).

    isgraph (int c)

    int 

    Checks whether a parameter is any printable character except the space character.

    (int c)

    int 

    Checks whether a parameter is a lowercase letter.

    isprint (int c)

    int 

    Checks whether a parameter is a printable character (including space).

    (int c)

    int 

    Checks whether a parameter is a punctuation or special character.

    isspace (int c)

    int 

    Checks whether a parameter is a space character.

    (int c)

    int 

    Checks whether a parameter is an uppercase letter.

    isxdigit (int c)

    int 

    Checks whether a parameter is a hexadecimal digit.

    (int c)

    int 

    Converts an uppercase letter specified by c to its lowercase equivalent.

    toupper (int c)

    int 

    Converts a lowercase letter specified by c to its uppercase equivalent.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is an alphabetic character or digit for the specified locale.

    isalpha_l (int c, locale_t locale)

    int 

    Checks whether a parameter is an alphabetic character for the specified locale.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is a blank character (including spaces and tabs) for the specified locale.

    iscntrl_l (int c, locale_t locale)

    int 

    Checks whether a parameter is a control character for the specified locale.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is a decimal digit for the specified locale.

    isgraph_l (int c, locale_t locale)

    int 

    Checks whether a parameter is any printable character except the space character for the specified locale.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is a character of lowercase letters for the specified locale.

    isprint_l (int c, locale_t locale)

    int 

    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.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is a punctuation or special character for the specified locale.

    isspace_l (int c, locale_t locale)

    int 

    Checks whether a parameter is a blank character for the specified locale.

    (int c, locale_t locale)

    int 

    Checks whether a parameter is a character of uppercase letters for the specified locale.

    isxdigit_l (int c, locale_t locale)

    int 

    Checks whether a parameter is a hexadecimal digit for the specified locale.

    (int c, locale_t locale)

    int 

    Converts an upper letter specified by c to its lowercase equivalent for the specified locale.

    toupper_l (int c, locale_t locale)

    int 

    Converts a lowercase letter specified by c to its uppercase equivalent for the specified locale.

    (int c)

    int 

    Converts a parameter of the integer type to an ASCII code.

    fmtmsg (long classification, const char label, int severity, const char text, const char action, const char tag)

    int 

    Prints formatted messages.

    (const char pattern, const char string, int flags)

    int 

    Matches a file name or a path name.

    getopt_long (int argc, char const argv, const char optstring, const struct longopts, int longindex)

    int 

    Parses the command-line arguments.

    getopt_long_only (int argc, char const argv, const char optstring, const struct longopts, int longindex)

    int 

    Parses the command-line arguments.

    imaxabs (intmax_t j)

    intmax_t 

    Calculates the absolute value of an input parameter of the integer type.

    (intmax_t numerator, intmax_t denominator)

    imaxdiv_t 

    Calculates the quotient and remainder after the division operation is performed on an integer.

    (const char str, char endptr, int base)

    intmax_t 

    Parses a string to a value of the intmax_t type.

    strtoumax (const char *str, char endptr, int base)

    uintmax_t 

    Parses a string to a value of the uintmax_t type.

    (const wchar_t str, wchar_t **endptr, int base)

    intmax_t 

    Parses a string to a value of the intmax_t type.

    wcstoumax (const wchar_t str, wchar_t endptr, int base)

    uintmax_t 

    Parses a string to a value of the uintmax_t type.

    (char s, size_t max, const char format,…)

    ssize_t 

    Converts a monetary value to a string.

    hcreate (size_t nel)

    int 

    Creates a hash table based on the number of entries.

    (void)

    void 

    Destroys a hash table.

    hsearch ( item, ACTION action)

    ENTRY  

    Adds or searches for a hash entry.

    (size_t nel, struct hsearch_data htab)

    int 

    Creates a hash table based on the number of entries and its description.

    (struct hsearch_data *htab)

    void 

    Destroys a hash table.

    (ENTRY item, ACTION action, retval, struct hsearch_data htab)

    int 

    Searches for a hash table.

    (void element, void pred)

    void 

    Adds an entry to a queue.

    remque (void elem)

    void 

    Removes an entry from a queue.

    (const void key, const void base, size_t nelp, size_t width, int(compar)(const void , const void ))

    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 ))

    void  

    Performs a linear search for a key in the array.

    (const void key, void **rootp, int(compar)(const void , const void ))

    void  

    Deletes a key from the binary tree.

    tfind (const void key, void const rootp, int(compar)(const void , const void ))

    void  

    Searches for a key in the binary tree.

    (const void key, void const rootp, int(compar)(const void , const void ))

    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))

    void 

    Traverses a binary tree from left to right.

    (void root, void(free_node)(void nodep))

    void 

    Releases all nodes in the binary tree.

    atoi (const char nptr)

    int 

    Converts an input string to an integer.

    (const char nptr)

    long 

    Converts an input string to a long integer.

    atoll (const char nptr)

    long long 

    Converts a string to an 8-byte long integer.

    (const char nptr)

    double 

    Converts an input string to a double-precision floating-point number.

    strtof (const char nptr, char endptr)

    float 

    Converts an input string to a floating-point number.

    (const char *nptr, char endptr)

    double 

    Converts a string to double.

    strtold (const char nptr, char **endptr)

    long double 

    Converts a string to long double.

    (const char nptr, char endptr, int base)

    long 

    Converts a string to a long integer according to the given base.

    strtoul (const char *nptr, char endptr, int base)

    unsigned long 

    Converts a string to an unsigned long integer according to the given base.

    (const char nptr, char **endptr, int base)

    long long 

    Converts a string to a long long integer according to the given base.

    strtoull (const char nptr, char endptr, int base)

    unsigned long long 

    Converts a string to an unsigned long long integer according to the given base.

    (void)

    int 

    Generates a pseudo-random number.

    srand (unsigned int seed)

    void 

    Initializes a random number generator.

    (size_t size)

    void  

    Dynamically allocates a memory block of size.

    calloc (size_t nmemb, size_t size)

    void  

    Dynamically allocates nmemb memory blocks of size.

    (void ptr, size_t size)

    void  

    Changes the size of the memory block pointed to by ptr to size bytes.

    free (void ptr)

    void 

    Releases the memory space pointed to by ptr.

    (void)

    _Noreturn void 

    Terminates an abnormal process and sends the SIGABRT signal to the caller.

    atexit (void(func)(void))

    int 

    Registers a termination function.

    (int status)

    void 

    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)

    char  

    Obtains the value of an environment variable.

    (int status)

    void 

    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)

    void 

    Aborts the program if assertion is false.

    (const char name)

    char  

    Obtains the value of an environment variable.

    bsearch (const void key, const void base, size_t nel, size_t width, int(compar)(const void , const void ))

    void  

    Searches for key using the binary search algorithm from the array element base[0] to base[num-1].

    (const void base, size_t nel, size_t width, int(compar)(const void , const void ))

    void 

    Sorts array elements base[0] to base[num-1] based on the comparison rules of compar.

    abs (int i)

    int 

    Obtains the absolute value of an integer value.

    (long i)

    long 

    Calculates the absolute value of a long integer.

    llabs (long long i)

    long long 

    Calculates the absolute value of a long long integer.

    (int numerator, int denominator)

    div_t 

    Calculates the quotient and remainder of an integer after division.

    (long numerator, long denominator)

    ldiv_t 

    Calculates the quotient and remainder of a long integer after division.

    (long long numerator, long long denominator)

    lldiv_t 

    Calculates the quotient and remainder of a long long integer after division.

    (const char s, size_t n)

    int 

    Obtains the number of bytes in the next multi-byte string.

    mbtowc (wchar_t pwc, const char s, size_t n)

    int 

    Converts a string constant to a wide character.

    (char s, wchar_t wc)

    int 

    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)

    size_t 

    Converts a multi-byte string to a wide-character string.

    (char dest, const wchar_t src, size_t n)

    size_t 

    Converts a wide-character string to a multi-byte string.

    posix_memalign (void memptr, size_t alignment, size_t size)

    int 

    Allocates memory with the specified size based on the given alignment.

    (const char name, const char value, int overwrite)

    int 

    Add or change an environment variable.

    unsetenv (const char name)

    int 

    Deletes an environment variable.

    (char template)

    int 

    Creates and opens a unique temporary file.

    mkostemp (char template, int flags)

    int 

    Creates and opens a unique temporary file.

    (char template)

    char  

    Creates a unique temporary directory based on template.

    getsubopt (char **optionp, char const tokens, char **valuep)

    int 

    Processes the parameters of an option in the command line.

    (unsigned seedp)

    int 

    Generates a pseudo-random number.

    realpath (const char __restrict path, char restrict resolved)

    char  

    Obtains a normalized absolute path.

    (void)

    long int 

    Generates a pseudo-random number.

    srandom (unsigned int seed)

    void 

    Initializes a random number generator.

    (unsigned int seed, char state, size_t n)

    char  

    Initializes a random number generator.

    setstate (char state)

    char  

    Sets the current state list for subsequent random use.

    (char s)

    int 

    Configures an environment variable.

    unlockpt (int fd)

    int 

    Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal.

    (int fd)

    char  

    Obtains the name of a pseudo terminal.

    l64a (long value)

    char  

    Converts a long integer to a 64-bit ASCII string.

    (const char str64)

    long 

    Converts between a 32-bit long integer and a little-endian 64-bit ASCII string.

    drand48 (void)

    double 

    Obtains a random number.

    (unsigned short xsubi[3])

    double 

    Obtains a random number.

    lrand48 (void)

    long int 

    Generates pseudo-random numbers evenly distributed between [0, 2^31).

    (unsigned short xsubi[3])

    long int 

    Generates pseudo-random numbers evenly distributed between [0, 2^31).

    mrand48 (void)

    long 

    Generates pseudo-random numbers evenly distributed between [-2^31, 2^31).

    (unsigned short xsubi[3])

    long 

    Generates pseudo-random numbers evenly distributed between [-2^31, 2^31).

    srand48 (long int seedval)

    void 

    Sets the start seed value for the pseudo-random number generator.

    (unsigned short[3])

    unsigned short  

    Generates an evenly distributed pseudo-random seed.

    lcong48 (unsigned short param[7])

    void 

    Sets the seed and related algorithm parameters for the pseudo-random number generator.

    (char template)

    char  

    Creates a unique temporary file name.

    mkstemps (char template, int suffixlen)

    int 

    Creates and opens a unique temporary file.

    (char template, int suffixlen, int flags)

    int 

    Creates and opens a unique temporary file.

    valloc (size_t size)

    void  

    Allocates memory with the specified size and aligns the allocated memory by page size.

    (double number, int ndigits, int decpt, int sign)

    char  

    Converts a double-precision floating-point number into a string.

    fcvt (double number, int ndigits, int decpt, int sign)

    char  

    Converts a floating-point number to a string.

    (double x, int n, char b)

    char  

    Converts a floating-point number to a string.

    memcpy (void restrict dest, const void __restrict src, size_t n)

    void  

    Copies a string (overlapping not allowed).

    (void dest, const void src, size_t n)

    void  

    Copies a string (overlapping allowed).

    memset (void s, int c, size_t n)

    void  

    Copies a character to the specified memory area.

    (const void s1, const void s2, size_t n)

    int 

    Compares two memory areas.

    memchr (const void s, int c, size_t n)

    void  

    Searches for a character in the specified memory area.

    (char dest, const char src)

    char  

    Copies a string.

    strncpy (char dest, const char src, size_t n)

    char  

    Copies n characters of a string.

    (char dest, const char src)

    char  

    Appends a string to another one.

    strncat (char dest, const char src, size_t n)

    char  

    Appends the first n bytes of a string to another one.

    (const char s1, const char s2)

    int 

    Compares two strings by characters.

    strncmp (const char s1, const char s2, size_t n)

    int 

    Compares the first n characters of two strings.

    (const char s1, const char s2)

    int 

    Compares two strings by character for the program’s current locale.

    strcoll_l (const char s1, const char s2, locale_t locale)

    int 

    Compares two strings by character for the specified locale.

    (char dest, const char src, size_t n)

    size_t 

    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.

    (const char s, int c)

    char  

    Locates the first occurrence of a character in a string.

    strrchr (const char s, int c)

    char  

    Locates the last occurrence of a character in a string.

    (const char s, const char reject)

    size_t 

    Obtains the length of the initial segment of a string that contains characters not in reject.

    strspn (const char s, const char )

    size_t 

    Obtains the length of the initial segment of a string that contains characters in accept.

    strpbrk (const char s, const char )

    char  

    Searches for any of a set of characters in a string.

    strstr (const char haystack, const char needle)

    char  

    Searches for a needle string in its haystack string.

    (char str, const char delim)

    char  

    Separates a string into a series of tokens separated by a delimiter.

    strlen (const char s)

    size_t 

    Calculates the length of a string.

    (int errnum)

    char  

    Obtains an error description string of the specified error code.

    strtok_r (char str, const char delim, char saveptr)

    char  

    Separates a string into a series of tokens separated by a delimiter, with the saveptr parameter specified.

    (int errnum, locale_t locale)

    char  

    Obtains an error description string of the specified error code for the specified locale.

    strerror_r (int errnum, char buf, size_t buflen)

    char  

    Obtains an error description string of the specified error code.

    (char dest, const char src)

    char  

    Copies a string.

    stpncpy (char dest, const char src, size_t n)

    char  

    Copies n characters of a string.

    (const char s, size_t maxlen)

    size_t 

    Calculates the length of a string.

    strdup (const char s)

    char  

    Copies a string to a new position.

    (const char s, size_t n)

    char  

    Copies n characters of a string to a new position.

    strsignal (int sig)

    char  

    Returns a string describing the signal number.

    (void __restrict dest, const void __restrict src, int c, size_t n)

    void * 

    Copies a memory area to another one.

    strsep (char stringp, const char delim)

    char  

    Separates a string into a series of tokens separated by a delimiter.

    (char d, const char s, size_t n)

    size_t 

    Appends the first n bytes of a string to another one.

    strlcpy (char d, const char s, size_t n)

    size_t 

    Copies a string.

    (const char s1, const char s2)

    int 

    Compares strings of two versions (string 1 and string 2) and returns the comparison result.

    strcasestr (const char haystack, const char needle)

    char  

    Searches for a needle string in its haystack string and returns a pointer.

    (const void haystack, size_t haystacklen, const void needle, size_t needlelen)

    void  

    Searches for a needle string in its haystack string.

    memrchr (const void s, int c, size_t n)

    void  

    Searches for a character in the specified memory area.

    (void dest, const void src, size_t n)

    void  

    Copies a string (overlapping not allowed).

    bcmp (const void s1, const void s2, size_t n)

    int 

    Compares byte sequences.

    (const void src, void dest, size_t n)

    void 

    Copies byte sequences.

    bzero (void s, size_t n)

    void 

    Sets byte sequences to zero.

    (const char s, int c)

    char  

    Searches for the first position of the matched character in a string.

    rindex (const char s, int c)

    char  

    Searches for the last position of the matched character in a string.

    (int i)

    int 

    Searches for the first bit in a word of the integer type.

    ffsl (long int i)

    int 

    Searches for the first bit in a word of the long integer type.

    (long long int i)

    int 

    Searches for the first bit in a word of the 8-byte long integer type.

    strcasecmp (const char _l, const char _r)

    int 

    Compares two strings (string 1 and string 2), regardless of the letter case.

    (const char _l, const char _r, size_t n)

    int 

    Compares a specified length of two strings (string 1 and string 2), regardless of the letter case.

    pipe (int pipefd[2])

    int 

    Creates an anonymous pipe.

    (int fd)

    int 

    Closes a file with a specified file descriptor.

    dup (int oldfd)

    int 

    Copies a specified file descriptor.

    (int oldfd, int newfd)

    int 

    Copies the descriptor of the target file to a specified descriptor.

    lseek (int fd, off_t offset, int whence)

    off_t 

    Sets the offset of the pointer to the file.

    (int fd)

    int 

    Synchronizes a file associated with a specified file descriptor to the storage device.

    read (int fd, void buf, size_t size)

    ssize_t 

    Reads the file contents and saves them in a specified buffer location.

    (int fd, const void buf, size_t size)

    ssize_t 

    Writes the specified content to the file.

    pread (int fd, void buf, size_t count, off_t offset)

    ssize_t 

    Reads data whose offset is offset and length is count from fd to the buffer.

    (int fd, const void buf, size_t count, off_t offset)

    ssize_t 

    Writes data from the buffer to fd whose offset is offset and length is count.

    unlink (const char path)

    int 

    Deletes a specified file.

    (int fd, const char path, int flag)

    int 

    Deletes a specified file.

    rmdir (const char path)

    int 

    Deletes a directory.

    (const char path, off_t length)

    int 

    Truncates a file to a specified size based on the file path.

    ftruncate (int fd, off_t length)

    int 

    Truncates a file to a specified length.

    (const char path, int mode)

    int 

    Checks whether a file has the corresponding permission.

    chdir (const char path)

    int 

    Switches the current working directory to a specified directory.

    (char buf, size_t size)

    char  

    Obtains the current working directory.

    alarm (unsigned int seconds)

    unsigned int 

    Arranges a signal to be sent to the current process after the number of seconds specified by seconds.

    (unsigned seconds)

    unsigned 

    Sleeps for a period of time.

    pause (void)

    int 

    Waits for signal.

    (void)

    pid_t 

    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[])

    int 

    Executes a specified user program file in ELF format.

    (const char path, char const arg[])

    int 

    Executes a specified user program file in ELF format.

    execle (const char path, const char arg,…)

    int 

    Executes a specified user program file in ELF format.

    (const char path, const char arg,…)

    int 

    Executes a specified user program file in ELF format.

    execvp (const char path, char const arg[])

    int 

    Executes a specified user program file in ELF format.

    (const char path, const char arg,…)

    int 

    Executes a specified user program file in ELF format.

    _exit (int status)

    _Noreturn void 

    Exits the process immediately and closes all opened file descriptors in the process.

    (const void from, void to, ssize_t n)

    void 

    Swaps bytes.

    getpid (void)

    pid_t 

    Obtains the process ID.

    (void)

    pid_t 

    Obtains the parent process ID.

    getpgrp (void)

    pid_t 

    Obtains the ID of the process group of the calling process.

    (pid_t pid)

    pid_t 

    Obtains the ID of the process group whose process ID is specified by pid.

    setpgid (pid_t pid, pid_t pgid)

    int 

    Sets the ID of the process group whose process ID is specified by pid.

    (int argc, char const argv[], const char optstring)

    int 

    Parses command-line arguments based on the specified option.

    getuid (void)

    uid_t 

    Obtains the real user ID (UID) of the calling process.

    (void)

    uid_t 

    Obtains the effective user ID (UID) of the calling process.

    getgid (void)

    gid_t 

    Obtains the real group ID (GID) of the calling process.

    (void)

    gid_t 

    Obtains the effective group ID (GID) of the calling process.

    getgroups (int size, gid_t list[])

    int 

    Obtains a list of supplementary user group IDs specific to the calling process.

    (uid_t uid)

    int 

    Sets the real user ID for the calling process.

    seteuid (uid_t euid)

    int 

    Sets the effective user ID of the calling process.

    (gid_t gid)

    int 

    Sets the user group ID of the calling process.

    setegid (gid_t egid)

    int 

    Sets the effective user group ID of the calling process.

    (const char path, int name)

    long 

    Obtains the configuration value of a file.

    setreuid (uid_t ruid, uid_t euid)

    int 

    Sets the real and effective user IDs of the calling process.

    (gid_t rgid, gid_t egid)

    int 

    Sets the real and effective user group IDs of the calling process.

    setpgrp (void)

    pid_t 

    Sets the process group ID of the calling process.

    (unsigned useconds)

    int 

    Sleeps for several microseconds.

    ualarm (unsigned value, unsigned interval)

    unsigned 

    Sets a microsecond-level timer.

    (size_t size, const gid_t list)

    int 

    Sets the supplementary user group list of the calling process.

    setresuid (uid_t ruid, uid_t euid, uid_t suid)

    int 

    Sets the real, effective, and saved user IDs of the calling process.

    (gid_t rgid, gid_t egid, gid_t sgid)

    int 

    Sets the real, effective, and saved group IDs of the calling process.

    getresuid (uid_t ruid, uid_t euid, uid_t suid)

    int 

    Obtains the real, effective, and saved user IDs of the calling process.

    (gid_t rgid, gid_t egid, gid_t sgid)

    int 

    Obtains the real, effective, and saved user group IDs of the calling process.

    get_current_dir_name (void)

    char  

    Obtains the name of the current working directory.

    (intptr_t increment)

    void  

    Adjusts the heap size of a process.

    getpagesize (void)

    int 

    Obtains the memory page size.

    (const char pathname, uid_t owner, gid_t group)

    int 

    Changes the user and group ownership of a file.

    wcscpy (wchar_t dest, const wchar_t src)

    wchar_t  

    Copies the wide characters pointed to by src to the wide character array pointed to by dest, including the terminating null character ‘\0’. .

    (wchar_t dest, const wchar_t src, size_t n)

    wchar_t  

    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)

    wchar_t  

    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’.

    (wchar_t dest, const wchar_t src, size_t n)

    wchar_t  

    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)

    int 

    Compares each character in the string pointed to by s1 with that in the string pointed to by s2 in ASCII-code order.

    (const wchar_t s1, const wchar_t s2, size_t n)

    int 

    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)

    int 

    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 .

    wcsxfrm (wchar_t s1, const wchar_t s2, size_t n)

    size_t 

    Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2.

    (const wchar_t wcs, wchar_t wc)

    wchar_t  

    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)

    wchar_t  

    Locates the last occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs.

    (const wchar_t wcs, const wchar_t accept)

    size_t 

    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.

    (const wchar_t wcs, const wchar_t accept)

    size_t 

    Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number matched characters in wcs.

    (const wchar_t wcs, const wchar_t accept)

    wchar_t  

    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.

    (wchar_t wcs, const wchar_t delim, wchar_t **ptr)

    wchar_t  

    Splits a wide character string pointed to by wcs into tokens using the given delimiter.

    wcslen (const wchar_t s)

    size_t 

    Calculates the length of a wide character string pointed to by s.

    (const wchar_t haystack, const wchar_t needle)

    wchar_t  

    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)

    wchar_t  

    Searches for the first position of the matched wide character within the specified number of characters in a wide character string.

    (const wchar_t lhs, const wchar_t rhs, size_t count)

    int 

    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)

    wchar_t  

    Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest.

    (wchar_t dest, const wchar_t src, size_t count)

    wchar_t  

    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)

    wchar_t  

    Fills count characters specified by ch to the wide character array pointed to by dest.

    (int c)

    wint_t 

    Converts a single-byte character c into its wide-character representation.

    wctob (wint_t c)

    int 

    Converts a wide character c into its single-byte representation.

    (const mbstate_t ps)

    int 

    Checks whether the mbstate_t object pointed to by ps is in the initial state.

    wcrtomb (char s, wchar_t wc, mbstate_t ps)

    size_t 

    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.

    (const char s, size_t n, mbstate_t ps)

    size_t 

    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)

    size_t 

    Converts a multi-byte character string with a length of len into a wide character string.

    (char dest, const wchar_t src, size_t len, mbstate_t ps)

    size_t 

    Converts a wide character string into a multi-byte string.

    wcstof (const wchar_t str, wchar_t endptr)

    float 

    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.

    (const wchar_t *str, wchar_t endptr)

    double 

    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)

    long double 

    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.

    (const wchar_t str, wchar_t endptr, int base)

    long 

    Converts a wide character string pointed to by str into a long value.

    wcstoul (const wchar_t *str, wchar_t endptr, int base)

    unsigned long 

    Converts a wide character string pointed to by str into an unsigned long value of a specified base.

    (const wchar_t str, wchar_t **endptr, int base)

    long long 

    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)

    unsigned long long 

    Converts a wide character string pointed to by str into an unsigned long long value of a specified base.

    (FILE stream, int mode)

    int 

    Sets and determines the orientation of the file stream.

    (const wchar_t format,…)

    int 

    Prints formatted data to the standard output (stdout).

    fwprintf ( __restrict fp, const wchar_t restrict fmt,…)

    int 

    Prints wide character strings to a specified file stream.

    swprintf (wchar_t wcs, size_t maxlen, const wchar_t format,…)

    int 

    Prints formatted data to a specified string.

    (const wchar_t format, va_list args)

    int 

    Prints formatted data from a variable argument list to the standard output (stdout).

    vfwprintf ( stream, const wchar_t *format, isoc_va_list args)

    int 

    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)

    int 

    Prints formatted data from a variable argument list specified by args to a specified string.

    (const wchar_t format,…)

    int 

    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.

    fwscanf ( stream, const wchar_t format,…)

    int 

    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,…)

    int 

    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.

    (const wchar_t format, va_list arg)

    int 

    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.

    vfwscanf ( stream, const wchar_t format, va_list arg)

    int 

    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)

    int 

    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.

    (FILE stream)

    wint_t 

    Reads a wide character from a specified file stream.

    (FILE stream)

    wint_t 

    Reads the first wide character from a specified file stream.

    (void)

    wint_t 

    Reads a wide character from the stdin.

    fputwc (wchar_t wc, stream)

    wint_t 

    Writes a wide character wc to a specified file stream.

    putwc (wchar_t wc, stream)

    wint_t 

    Writes a wide character wc to a specified file stream.

    putwchar (wchar_t wc)

    wint_t 

    Writes a wide character wc to the stdout.

    (wchar_t ws, int n, FILE stream)

    wchar_t  

    Reads wide characters from a specified file stream.

    (const wchar_t ws, FILE stream)

    int 

    Writes a wide string pointed to by ws to a specified file stream.

    (wint_t ch, FILE stream)

    wint_t 

    Pushes a character back into a specified file stream.

    (wchar_t pwc, const char s, size_t n, mbstate_t ps)

    size_t 

    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)

    size_t 

    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.

    (char dest, const wchar_t *src, size_t nwc, size_t len, mbstate_t ps)

    size_t 

    Converts nwc wide characters in the string pointed to by src into a character string.

    wcsdup (const wchar_t s)

    wchar_t  

    Copies a specified wide character string to a newly allocated buffer.

    (const wchar_t s, size_t maxlen)

    size_t 

    Calculates the length of a wide character string pointed to by s.

    wcpcpy (wchar_t dest, const wchar_t src)

    wchar_t  

    Copies the wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest.

    (wchar_t dest, const wchar_t src, size_t n)

    wchar_t  

    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)

    int 

    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.

    (const wchar_t s1, const wchar_t s2, locale_t locale)

    int 

    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)

    int 

    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.

    (const wchar_t s1, const wchar_t s2, size_t n, locale_t locale)

    int 

    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)

    int 

    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.

    (wchar_t restrict wcs, size_t n, const wchar_t *restrict f, const struct tm __restrict )

    size_t 

    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)

    size_t 

    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.

    (wint_t wc)

    int 

    Checks whether a wide character is a letter or digit.

    iswalpha (wint_t wc)

    int 

    Checks whether a wide character is a letter.

    (wint_t wc)

    int 

    Checks whether a wide character is a space or tab character (\t).

    iswcntrl (wint_t wc)

    int 

    Checks whether a wide character is a control character.

    (wint_t wc)

    int 

    Checks whether a wide character is a decimal digit.

    iswgraph (wint_t wc)

    int 

    Checks whether a wide character is visible.

    (wint_t wc)

    int 

    Checks whether a wide character is a lowercase letter.

    iswprint (wint_t wc)

    int 

    Checks whether a wide character is printable.

    (wint_t wc)

    int 

    Checks whether a wide character is a punctuation mark.

    iswupper (wint_t wc)

    int 

    Checks whether a wide character is an uppercase letter.

    (wint_t wc)

    int 

    Checks whether a wide character is a hexadecimal digit.

    iswctype (wint_t wc, wctype_t desc)

    int 

    Checks whether the character specified by wc belongs to the desc class.

    (wint_t wc, wctrans_t desc)

    wint_t 

    Translates the type of a wide character based on the conversion mapping relationship.

    (wint_t wc)

    wint_t 

    Converts an uppercase wide character to lowercase.

    towupper (wint_t wc)

    wint_t 

    Converts a lowercase wide character to uppercase.

    (const char name)

    wctrans_t 

    Determines a mapping which can map a wide character to another wide character.

    (const char name)

    wctype_t 

    Checks whether a wide character type exists in the LC_CTYPE locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is a letter or digit for the specified locale.

    iswalpha_l (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is alphabetic for the specified locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is a blank or \t character for the specified locale.

    iswcntrl_l (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is a control character for the specified locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is a decimal digit for the specified locale.

    iswgraph_l (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is visible for the specified locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is in lowercase for the specified locale.

    iswprint_l (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is printable for the specified locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether wc is a punctuation wide character for the specified locale.

    iswspace (wint_t wc)

    int 

    Checks whether a wide character belongs to the wide-character class space.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character belongs to the wide-character class space for the specified locale.

    iswupper_l (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is in uppercase for the specified locale.

    (wint_t wc, locale_t locale)

    int 

    Checks whether a wide character is a hexadecimal digit for the specified locale.

    iswctype_l (wint_t wc, wctype_t desc, locale_t locale)

    int 

    Checks whether the character specified by wc belongs to the desc class for the specified locale.

    (wint_t wc, locale_t locale)

    wint_t 

    Converts an uppercase wide character to lowercase for the specified locale.

    towupper_l (wint_t wc, locale_t locale)

    wint_t 

    Converts a lowercase wide character to uppercase for the specified locale.

    (wint_t wc, wctype_t desc, locale_t locale)

    wint_t 

    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)

    wctype_t 

    Checks whether a wide character type exists for the specified locale.

    Details

    Macro Definition Documentation

    _tolower

    Description:

    Converts an uppercase letter to its lowercase equivalent.

    Parameters:

    Name

    Description

    a Indicates the parameter to convert.

    Returns:

    Returns the converted lowercase letter if the conversion is successful.

    _toupper

    Description:

    Converts a lowercase letter to its uppercase equivalent.

    Parameters:

    Name

    Description

    a Indicates the parameter to convert.

    Returns:

    Returns the converted uppercase letter if the conversion is successful.

    isascii

    1. #define isascii( a) (0 ? isascii(a) : (unsigned)(a) < 128)

    Description:

    Checks whether a parameter is an ASCII character.

    Parameters:

    Name

    Description

    a Indicates the parameter to check.

    Returns:

    Returns a non-zero value if the operation is successful; returns 0 otherwise.

    strdupa

    1. #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

    1. #define va_arg( v, l ) __builtin_va_arg(v,l)

    Description:

    Obtains the next argument in the variable-length argument list.

    Parameters:

    Name

    Description

    v Indicates the va_list v initialized by . 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

    1. #define va_copy( d, s ) __builtin_va_copy(d,s)

    Description:

    Copies the previously initialized variable argument list s to d.

    Parameters:

    Name

    Description

    d Indicates the destination variable.
    s Indicates the source variable.

    va_end

    1. #define va_end( v) __builtin_va_end(v)

    Description:

    Ends a variable-length argument list.

    This function releases a calling function.

    Parameters:

    Name

    Description

    v Indicates the va_list v initialized by .

    Attention:

    After va_end is called, v is a random value.

    va_start

    1. #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 and va_end, and must be called first.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    status Indicates the status sent to the parent process when the calling process ends.

    _exit()

    1. _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:

    Name

    Description

    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()

    1. long a64l (const char * str64)

    Description:

    Converts between a 32-bit long integer and a little-endian 64-bit ASCII string.

    Parameters:

    Name

    Description

    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()

    1. _Noreturn void abort (void )

    Description:

    Terminates an abnormal process and sends the SIGABRT signal to the caller.

    abs()

    1. int abs (int i)

    Description:

    Obtains the absolute value of an integer value.

    Parameters:

    Name

    Description

    i Indicates the integer value.

    Returns:

    Returns the absolute value.

    access()

    1. int access (const char * path, int mode )

    Description:

    Checks whether a file has the corresponding permission.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EACCES

    The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix component.

    EFAULT

    Invalid address.

    ENOENT

    The component of path does not exist or the path is an empty string.

    ENOMEM

    Insufficient memory.

    alarm()

    1. 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:

    Name

    Description

    seconds Indicates an unsigned integer seconds needs to be transferred.

    Attention:

    An exception occurs when this function is used together with , ualarm(), and . This function shares a timer with setitimer() and . 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()

    1. 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:

    Name

    Description

    expression Indicates the condition variable. If the value of expression is false, an error message is displayed and the process is terminated.

    atexit()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    nptr Indicates the string to be converted.

    Returns:

    Returns the converted value if the operation is successful; returns 0 if the operation fails.

    atoi()

    1. int atoi (const char * nptr)

    Description:

    Converts an input string to an integer.

    The conversion stops when a non-numeric character is encountered.

    Parameters:

    Name

    Description

    nptr Indicates the string to be converted.

    Returns:

    Returns the converted value if the operation is successful; returns 0 if the operation fails.

    atol()

    1. long atol (const char * nptr)

    Description:

    Converts an input string to a long integer.

    Parameters:

    Name

    Description

    nptr Indicates the string to be converted.

    Returns:

    Returns the converted value if the operation is successful; returns 0 if the operation fails.

    atoll()

    1. 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:

    Name

    Description

    nptr Indicates the string to be converted.

    Returns:

    Returns the converted value if the operation is successful; returns 0 if the operation fails.

    bcmp()

    1. 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:

    Name

    Description

    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 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()

    1. 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:

    Name

    Description

    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 in new projects.

    bsearch()

    1. void* bsearch (const void * key, const void * base, size_t nel, size_t width, int(*)(const void *, const void *) compar )

    Description:

    Parameters:

    Name

    Description

    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()

    1. wint_t btowc (int c)

    Description:

    Converts a single-byte character c into its wide-character representation.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. void* calloc (size_t nmemb, size_t size )

    Description:

    Dynamically allocates nmemb memory blocks of size.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    ENOMEM

    Insufficient memory.

    chdir()

    1. int chdir (const char * path)

    Description:

    Switches the current working directory to a specified directory.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EINVAL

    path is set to NULL.

    ENAMETOOLONG

    The length of the path name is greater than .

    ENOMEM

    Insufficient memory.

    ENOTDIR

    path is not a directory name.

    ENOENT

    The path does not exist.

    chown()

    1. int chown (const char * pathname, uid_t owner, gid_t group )

    Description:

    Changes the user and group ownership of a file.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EINVAL

    pathname is a null pointer or an empty string.

    EACCES

    The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix directory.

    EFAULT

    Invalid address.

    ENAMETOOLONG

    The length of the path name is greater than .

    ENOENT

    The directory component in the path name does not exist.

    ENOMEM

    Insufficient memory.

    ENOTDIR

    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.

    EPERM

    The operation is not allowed or access is denied because the access is prohibited or the directory is full.

    EROFS

    The physical drive is write-protected.

    EEXIST

    The file or directory already exists.

    ENOSYS

    The operation is not supported.

    close()

    1. int close (int fd)

    Description:

    Closes a file with a specified file descriptor.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EBADF

    fd is invalid.

    EINVAL

    The file is not owned by the current process.

    ENOENT

    The file does not exist.

    ENODEV

    The disk partition is not found.

    crypt()

    1. 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:

    Name

    Description

    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:

    Encryption Algorithm

    Encryption Prefix

    Number of Random Characters

    SHA-2-512

    ‘$6$’

    16

    SHA-2-256

    ‘$5$’

    16

    MD5

    ‘$1$’

    8

    DES

    ‘’

    2

    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.

    Input

    Error code

    setting is set to NULL.

    The hash password or encryption algorithm is not supported.

    ENOSYS

    The system does not allow the encryption algorithm.

    div()

    1. [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:

    Name

    Description

    numerator Indicates the numerator.
    denominator Indicates the denominator.

    Returns:

    Returns a structure variable that has been defined in the function.

    drand48()

    1. 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 , seed48(), and .

    Returns:

    Returns the obtained double-precision random number.

    dup()

    1. int dup (int oldfd)

    Description:

    Copies a specified file descriptor.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EBADF

    oldfd is invalid.

    EMFILE

    Failed to allocate file descriptors because too many files are opened.

    ENOENT

    The index node cannot be found based on the path name associated with oldfd.

    ENOSYS

    The operation is not supported.

    ENOMEM

    Insufficient memory.

    dup2()

    1. int dup2 (int oldfd, int newfd )

    Description:

    Copies the descriptor of the target file to a specified descriptor.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EBADF

    oldfd is invalid.

    EMFILE

    Failed to allocate file descriptors because too many files are opened.

    ENOENT

    The index node cannot be found based on the path name associated with oldfd.

    ENOSYS

    The operation is not supported.

    ENOMEM

    Insufficient memory.

    ecvt()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    xsubi Indicates the array of the initialized value of Xi.

    execl()

    1. int execl (const char * path, const char * arg, ... )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    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()

    1. int execle (const char * path, const char * arg, ... )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    path Indicates the full path of the ELF file.
    arg Indicates the list of parameters required by the program. The arg parameter must point to a new environment variable array, that is, the environment variable of the new program.

    Returns:

    Returns -1 and sets errno to the corresponding error code if the operation fails.

    execlp()

    1. int execlp (const char * path, const char * arg, ... )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    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()

    1. int execv (const char * path, char *const arg[] )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    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 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()

    1. int execve (const char * path, char *const arg[], char *const envp[] )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    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 if the operation fails.

    execvp()

    1. int execvp (const char * path, char *const arg[] )

    Description:

    Executes a specified user program file in ELF format.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    status Indicates the status sent to the parent process when the calling process ends.

    fcvt()

    1. char* fcvt (double number, int ndigits, int * decpt, int * sign )

    Description:

    Converts a floating-point number to a string.

    Parameters:

    Name

    Description

    number Indicates the floating-point number to be converted.
    ndigits Indicates the number of decimal places.
    decpt Indicates the position of the decimal point, which can be obtained by users.
    sign Indicates the symbol of number, which can be obtained by users. 0 indicates a positive number, and 1 indicates a negative number.

    Returns:

    Returns the converted string.

    ffs()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. wint_t fgetwc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)

    Description:

    Reads a wide character from a specified file stream.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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_ERROR, , 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.

    Message Type

    Macro Definition Corresponding to the Message Description

    Message output device

    MM_PRINT, or both

    Message source

    MM_HARD, , or MM_FIRM

    Message detector

    , MM_UTIL, or

    Severity of the incident

    MM_RECOVER or

    Attention:

    All parameters in this function can be ignored based on the following definitions: MM_NULLLBL, , MM_NULLTXT, , and MM_NULLTAG.

    Returns:

    The function can return 4 values: , MM_NOTOK, , and MM_NOCON.

    fnmatch()

    1. 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:

    Name

    Description

    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_PATHNAME, , FNM_LEADING_DIR, , and FNM_FILE_NAME.

    Returns:

    Returns 0 if the matching is successful; returns if the matching fails; returns a non-zero value if an error occurs.

    fork()

    1. 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.

    errno

    Description

    EAGAIN

    Insufficient process or thread control blocks.

    ENOMEM

    Insufficient memory.

    fputwc()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. void free (void * ptr)

    Description:

    Releases the memory space pointed to by ptr.

    The memory space was allocated by using , malloc(), or .

    Parameters:

    Name

    Description

    ptr Indicates the pointer to the memory space to be released.

    fsync()

    1. int fsync (int fd)

    Description:

    Synchronizes a file associated with a specified file descriptor to the storage device.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EBADF

    fd is invalid.

    EINVAL

    fd is invalid for this device.

    ENOSYS

    The operation is not supported.

    ftruncate()

    1. int ftruncate (int fd, off_t length )

    Description:

    Truncates a file to a specified length.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EACCES

    The file has no write permission.

    EBADF

    Failed to open the file in the specified path.

    EINVAL

    The target length is less than 0.

    ENOSYS

    The operation is not supported.

    EPERM

    Failed to obtain the file structure corresponding to the file specified by path, or the file access is rejected.

    fwide()

    1. int fwide ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, int mode )

    Description:

    Sets and determines the orientation of the file stream.

    Parameters:

    Name

    Description

    stream Indicates the pointer to the file object that identifies a stream.
    mode Indicates the orientation of the stream. The value can be: A negative value indicating that the stream is byte-oriented A positive value indicating that the stream is wide-oriented 0 indicating that the stream orientation is not set

    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()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. char* gcvt (double x, int n, char * b )

    Description:

    Converts a floating-point number to a string.

    Parameters:

    Name

    Description

    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()

    1. 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()

    1. char* getcwd (char * buf, size_t size )

    Description:

    Obtains the current working directory.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EINVAL

    buf is set to NULL.

    ERANGE

    size is less than the length of the current working directory (including the terminating null byte \0).

    ENAMETOOLONG

    Failed to copy the name of the current working directory to the buffer using memcpy_s.

    getegid()

    1. gid_t getegid (void )

    Description:

    Obtains the effective group ID (GID) of the calling process.

    Returns:

    Returns the effective GID.

    getenv()

    1. char* getenv (const char * name)

    Description:

    Obtains the value of an environment variable.

    Parameters:

    Name

    Description

    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()

    1. uid_t geteuid (void )

    Description:

    Obtains the effective user ID (UID) of the calling process.

    Returns:

    Returns the effective UID.

    getgid()

    1. gid_t getgid (void )

    Description:

    Obtains the real group ID (GID) of the calling process.

    Returns:

    Returns the real GID.

    getgroups()

    1. int getgroups (int size, gid_t list[] )

    Description:

    Obtains a list of supplementary user group IDs specific to the calling process.

    Parameters:

    Name

    Description

    size Indicates the maximum size allowed for the supplementary group list. If the value is 0, this function obtains the total number of supplementary groups.
    list Indicates the list of supplementary groups.

    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.

    errno

    Description

    EINVAL

    size is invalid.

    EFAULT

    Invalid address.

    ENOMEM

    Insufficient memory.

    getopt()

    1. int getopt (int argc, char *const argv[], const char * optstring )

    Description:

    Parses command-line arguments based on the specified option.

    Parameters:

    Name

    Description

    argc Indicates the number of arguments when the file of the function is executed.
    argv Indicates the argument content when the file of the function is executed.
    optstring Indicates the string containing the optional arguments of the executable file. If this function obtains an option without arguments, the value of optind increases by 1. If this function obtains an option with arguments and the result is saved to optarg, the value of optind increases by 2.

    Character Option Expression

    Description

    Only characters that indicate different options are available.

    abc indicates that the file has three options -a, -b, and -c.

    The character is followed by a colon.

    b indicates that -b must be followed by an argument in the executable file that contains the getopt() function.

    The character is followed by two colons.

    b indicates that -b can be followed by or without the corresponding argument in the executable file that contains the 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()

    1. 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:

    Name

    Description

    argc Indicates the number of command-line arguments.
    argv Indicates the command-line argument content.
    optstring Indicates the string containing the optional arguments of the executable file.
    longopts Indicates the long argument structure.
    longindex Indicates the index of the current long argument in longopts.

    Character Option Expression

    Description

    Only characters that indicate different options are available.

    abc indicates that the file has three options -a, -b, and -c.

    The character is followed by a colon.

    b indicates that -b must be followed by an argument in the executable file that contains the function.

    The character is followed by two colons.

    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()

    1. 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:

    Name

    Description

    argc Indicates the number of command-line arguments.
    argv Indicates the command-line argument content.
    optstring Indicates the string containing the optional arguments of the executable file.
    longopts Indicates the long argument structure.
    longindex Indicates the index of the current long argument in longopts.

    Character Option Expression

    Description

    Only characters that indicate different options are available.

    abc indicates that the file has three options -a, -b, and -c.

    The character is followed by a colon.

    b indicates that -b must be followed by an argument in the executable file that contains the getopt() function.

    The character is followed by two colons.

    b indicates that -b can be followed by or without the corresponding argument in the executable file that contains the 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()

    1. int getpagesize (void )

    Description:

    Obtains the memory page size.

    Returns:

    Returns the number of bytes in a memory page.

    getpgid()

    1. pid_t getpgid (pid_t pid)

    Description:

    Obtains the ID of the process group whose process ID is specified by pid.

    Parameters:

    Name

    Description

    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.

    errno

    Description

    EINVAL

    Invalid process ID.

    ESRCH

    The specified process cannot be found.

    getpgrp()

    1. 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()

    1. pid_t getpid (void )

    Description:

    Obtains the process ID.

    Returns:

    Returns the process ID.

    getppid()

    1. pid_t getppid (void )

    Description:

    Obtains the parent process ID.

    Returns:

    Returns the parent process ID.

    getresgid()

    1. 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:

    Name

    Description

    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.

    errno

    Description

    EFAULT

    Invalid address.

    getresuid()

    1. 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:

    Name

    Description

    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.

    errno

    Description

    EFAULT

    Invalid address.

    getsubopt()

    1. 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 to process the parameters of an option. You are advised to use this function if the parameters of an option are complex.

    Parameters:

    Name

    Description

    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.

    getuid()

    1. uid_t getuid (void )

    Description:

    Obtains the real user ID (UID) of the calling process.

    Returns:

    Returns the real UID.

    getwc()

    1. wint_t getwc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)

    Description:

    Reads the first wide character from a specified file stream.

    Parameters:

    Name

    Description

    stream Indicates the pointer to the file object that identifies a stream.

    Attention:

    This function is similar to 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()

    1. 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()

    1. int hcreate (size_t nel)

    Description:

    Creates a hash table based on the number of entries.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. void hdestroy (void )

    Description:

    Destroys a hash table.

    This function releases the memory for creating a hash table.

    hdestroy_r()

    1. 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:

    Name

    Description

    htab Indicates the hash table.

    hsearch()

    1. [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:

    Name

    Description

    item Indicates the hash table entry to be searched.
    action Indicates the function action. ENTER indicates that an entry is added, and FIND indicates that an entry is searched. For details, see ACTION.

    Returns:

    Returns the pointer to the hash table if the operation is successful.

    hsearch_r()

    1. 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:

    Name

    Description

    item Indicates the hash table entry to be searched.
    action Indicates the function action. ENTER indicates that an entry is added, and FIND indicates that an entry is searched. ACTION
    htab Indicates the hash table.

    Returns:

    Returns a non-zero value if the operation is successful; returns 0 if the operation fails.

    imaxabs()

    1. 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:

    Name

    Description

    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()

    1. [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:

    Name

    Description

    numerator Indicates the numerator.
    denominator Indicates the denominator.

    Returns:

    Returns a structure variable that has been defined in the function.

    index()

    1. char* index (const char * s, int c )

    Description:

    Searches for the first position of the matched character in a string.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. void insque (void * element, void * pred )

    Description:

    Adds an entry to a queue.

    Parameters:

    Name

    Description

    element Indicates the element to be added to the queue.
    pred After the position of prev to add the element.

    isalnum()

    1. int isalnum (int c)

    Description:

    Checks whether a parameter is an alphabetic character or a decimal digit.

    Parameters:

    Name

    Description

    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()

    1. int isalnum_l (int c, locale_t locale )

    Description:

    Checks whether a parameter is an alphabetic character or digit for the specified locale.

    Parameters:

    Name

    Description

    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()

    1. int isalpha (int c)

    Description:

    Checks whether a parameter is an alphabetic character.

    Parameters:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is an alphabetic character; returns 0 otherwise.

    isalpha_l()

    1. int isalpha_l (int c, locale_t locale )

    Description:

    Checks whether a parameter is an alphabetic character for the specified locale.

    Parameters:

    Name

    Description

    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()

    1. int isblank (int c)

    Description:

    Checks whether a parameter is a blank character (space or tap).

    Parameters:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a blank character; returns 0 otherwise.

    isblank_l()

    1. 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:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a control character; returns 0 otherwise.

    iscntrl_l()

    1. 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:

    Name

    Description

    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()

    1. int isdigit (int c)

    Description:

    Checks whether a parameter is a decimal digit (0-9).

    Parameters:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a decimal digit; returns 0 otherwise.

    isdigit_l()

    1. int isdigit_l (int c, locale_t locale )

    Description:

    Checks whether a parameter is a decimal digit for the specified locale.

    Parameters:

    Name

    Description

    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()

    1. int isgraph (int c)

    Description:

    Checks whether a parameter is any printable character except the space character.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    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()

    1. int islower (int c)

    Description:

    Checks whether a parameter is a lowercase letter.

    Parameters:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a lowercase letter; returns 0 otherwise.

    islower_l()

    1. int islower_l (int c, locale_t locale )

    Description:

    Checks whether a parameter is a character of lowercase letters for the specified locale.

    Parameters:

    Name

    Description

    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()

    1. 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:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a printable character; returns 0 otherwise.

    isprint_l()

    1. 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:

    Name

    Description

    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()

    1. int ispunct (int c)

    Description:

    Checks whether a parameter is a punctuation or special character.

    Parameters:

    Name

    Description

    c Indicates the parameter to check.

    Returns:

    Returns a non-zero value if c is a punctuation or special character; returns 0 otherwise.

      Description:

      Checks whether a parameter is a punctuation or special character for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      c Indicates the parameter to check.

      Returns:

      Returns a non-zero value if c is a space character; returns 0 otherwise.

      isspace_l()

      1. 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:

      Name

      Description

      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()

      1. int isupper (int c)

      Description:

      Checks whether a parameter is an uppercase letter.

      Parameters:

      Name

      Description

      c Indicates the parameter to check.

      Returns:

      Returns a non-zero value if c is an uppercase letter; returns 0 otherwise.

      isupper_l()

      1. int isupper_l (int c, locale_t locale )

      Description:

      Checks whether a parameter is a character of uppercase letters for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswalnum (wint_t wc)

      Description:

      Checks whether a wide character is a letter or digit.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswalnum_l()

      Description:

      Checks whether a wide character is a letter or digit for the specified locale.

      Parameters:

      Name

      Description

      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()

      Description:

      Checks whether a wide character is a letter.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswalpha_l()

      1. int iswalpha_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is alphabetic for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswblank (wint_t wc)

      Description:

      Checks whether a wide character is a space or tab character (\t).

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswblank_l()

      1. 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:

      Name

      Description

      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()

      1. int iswcntrl (wint_t wc)

      Description:

      Checks whether a wide character is a control character.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswcntrl_l()

      1. int iswcntrl_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is a control character for the specified locale.

      Parameters:

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswctype()

      1. int iswctype (wint_t wc, wctype_t desc )

      Description:

      Checks whether the character specified by wc belongs to the desc class.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. int iswdigit (wint_t wc)

      Description:

      Checks whether a wide character is a decimal digit.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswdigit_l()

      1. int iswdigit_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is a decimal digit for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswgraph (wint_t wc)

      Description:

      Checks whether a wide character is visible.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswgraph_l()

      1. int iswgraph_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is visible for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswlower (wint_t wc)

      Description:

      Checks whether a wide character is a lowercase letter.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswlower_l()

      1. int iswlower_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is in lowercase for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswprint (wint_t wc)

      Description:

      Checks whether a wide character is printable.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswprint_l()

      1. int iswprint_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is printable for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswpunct (wint_t wc)

      Description:

      Checks whether a wide character is a punctuation mark.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswpunct_l()

      1. int iswpunct_l (wint_t wc, locale_t locale )

      Description:

      Checks whether wc is a punctuation wide character for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswspace (wint_t wc)

      Description:

      Checks whether a wide character belongs to the wide-character class space.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswspace_l()

      1. 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:

      Name

      Description

      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()

      1. int iswupper (wint_t wc)

      Description:

      Checks whether a wide character is an uppercase letter.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswupper_l()

      1. int iswupper_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is in uppercase for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int iswxdigit (wint_t wc)

      Description:

      Checks whether a wide character is a hexadecimal digit.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns a non-zero value if the operation is successful; returns 0 otherwise.

      iswxdigit_l()

      1. int iswxdigit_l (wint_t wc, locale_t locale )

      Description:

      Checks whether a wide character is a hexadecimal digit for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int isxdigit (int c)

      Description:

      Checks whether a parameter is a hexadecimal digit.

      Parameters:

      Name

      Description

      c Indicates the parameter to check.

      Returns:

      Returns a non-zero value if c is a hexadecimal digit; returns 0 otherwise.

      isxdigit_l()

      1. int isxdigit_l (int c, locale_t locale )

      Description:

      Checks whether a parameter is a hexadecimal digit for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. long jrand48 (unsigned short xsubi[3])

      Description:

      Generates pseudo-random numbers evenly distributed between [-2^31, 2^31).

      Parameters:

      Name

      Description

      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()

      1. char* l64a (long value)

      Description:

      Converts a long integer to a 64-bit ASCII string.

      Parameters:

      Name

      Description

      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()

      1. long labs (long i)

      Description:

      Calculates the absolute value of a long integer.

      Parameters:

      Name

      Description

      i Indicates the long integer to be converted.

      Returns:

      Returns the absolute value.

      lcong48()

      1. void lcong48 (unsigned short param[7])

      Description:

      Sets the seed and related algorithm parameters for the pseudo-random number generator.

      Parameters:

      Name

      Description

      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()

      1. [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:

      Name

      Description

      numerator Indicates the numerator.
      denominator Indicates the denominator.

      Returns:

      Returns a structure variable that has been defined in the function.

      lfind()

      1. 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:

      Name

      Description

      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()

      1. long long llabs (long long i)

      Description:

      Calculates the absolute value of a long long integer.

      Parameters:

      Name

      Description

      i Indicates the long long integer to be converted.

      Returns:

      Returns the absolute value.

      lldiv()

      1. [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:

      Name

      Description

      numerator Indicates the numerator.
      denominator Indicates the denominator.

      Returns:

      Returns a structure variable that has been defined in the function.

      lrand48()

      1. 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(), , 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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      fd Indicates the file descriptor.
      offset Indicates the pointer offset to be set.
      whence Indicates the pointer position. The value can be SEEK_CUR (current position), SEEK_SET (beginning of the file), or SEEK_END (end of the file).

      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.

      errno

      Description

      EBADF

      fd is invalid.

      ENOSYS

      This operation is not supported.

      EINVAL

      whence is invalid.

      EIO

      A hardware error occurs at the I/O layer.

      malloc()

      1. void* malloc (size_t size)

      Description:

      Dynamically allocates a memory block of size.

      The allocated memory is not initialized.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      ENOMEM

      Insufficient memory.

      mblen()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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 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()

      1. 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:

      Name

      Description

      pwc Indicates the pointer to the destination wide character array to store the converted string.
      s Indicates the pointer to the multi-byte character string to be converted.
      n Indicates the number of bytes to read from s.
      ps Indicates the pointer to the mbstate_t object describing the conversion state.

      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 . If the converted wide character is L’\ 0’, this function returns 0 and resets * ps to the initial state.

      mbsinit()

      1. int mbsinit (const mbstate_t * ps)

      Description:

      Checks whether the mbstate_t object pointed to by ps is in the initial state.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      dest Indicates the pointer to the destination wide character array to store the converted string.
      src Indicates the double pointer to the source string to be converted.
      nwc Indicates the number of wide characters that can be written to the destination wide character array.
      len Indicates the number of characters to be converted.
      ps Indicates the pointer to the mbstate_t object describing the conversion state.

      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()

      1. 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:

      Name

      Description

      dest Indicates the pointer to the destination wide character array to store the converted string.
      src Indicates the double pointer to the source string to be converted.
      len Indicates the number of wide characters to be converted.
      ps Indicates the pointer to the mbstate_t object describing the conversion state.

      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 . 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()

      1. size_t mbstowcs (wchar_t * dest, const char * src, size_t n )

      Description:

      Converts a multi-byte string to a wide-character string.

      Parameters:

      Name

      Description

      dest Indicates the pointer to an array for the wchar_t element. The array length can store a wide-character string whose length is specified by n.
      src Indicates the pointer to the multi-byte string to convert.
      n Indicates the maximum number of wide characters to convert.

      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()

      1. 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:

      Name

      Description

      pwc Indicates the pointer to the string for storing the wide character.
      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.

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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 instead.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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 except for the return value. This function returns the pointer to the last byte written during the copy.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* mkdtemp (char * template)

      Description:

      Creates a unique temporary directory based on template.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The last six characters are not XXXXXX.

      Other

      For details, see .

      See also:

      mkdir

      mkostemp()

      1. int mkostemp (char * template, int flags )

      Description:

      Creates and opens a unique temporary file.

      Different from mkstemp, this function has the flags parameter.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The last six characters are not XXXXXX.

      EEXIST

      Failed to create a unique temporary file name.

      Other

      For details, see open().

      See also:

      mkostemps()

      1. int mkostemps (char * template, int suffixlen, int flags )

      Description:

      Creates and opens a unique temporary file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The template length is less than (6 + suffixlen), or the last six characters of template are not XXXXXX.

      EEXIST

      Failed to create a unique temporary file name.

      Other

      For details, see .

      See also:

      open

      mkstemp()

      1. int mkstemp (char * template)

      Description:

      Creates and opens a unique temporary file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The last six characters are not XXXXXX.

      EEXIST

      Failed to create a unique temporary file name.

      Other

      For details, see open().

      See also:

      mkstemps()

      1. int mkstemps (char * template, int suffixlen )

      Description:

      Creates and opens a unique temporary file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The template length is less than (6 + suffixlen), or the last six characters of template are not XXXXXX.

      EEXIST

      Failed to create a unique temporary file name.

      Other

      For details, see .

      See also:

      open

      mktemp()

      1. char* mktemp (char * template)

      Description:

      Creates a unique temporary file name.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The last six characters are not XXXXXX.

      ENOENT

      The file name already exists.

      mrand48()

      1. 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 , seed48(), and must be used to initialize Xi.

      Returns:

      Returns signed long integers evenly distributed between [-2^31, 2^31) if the operation is successful.

      nrand48()

      1. long int nrand48 (unsigned short xsubi[3])

      Description:

      Generates pseudo-random numbers evenly distributed between [0, 2^31).

      Parameters:

      Name

      Description

      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()

      1. long pathconf (const char * path, int name )

      Description:

      Obtains the configuration value of a file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The value of name does not match any existing configuration option.

      pause()

      1. 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.

      errno

      Description

      EINTR

      A signal was caught during execution.

      pipe()

      1. int pipe (int pipefd[2])

      Description:

      Creates an anonymous pipe.

      Parameters:

      Name

      Description

      pipefd Indicates the pointer to the buffer for storing the created pipe descriptor. The buffer has two sizes of the int type, one for the read-end descriptor and the other for the write-end descriptor.

      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.

      errno

      Description

      EFAULT

      pipefd is invalid.

      ENOMEM

      Creation failed due to insufficient space.

      ENFILE

      Failed to create an anonymous pipe because the number of anonymous pipes has reached the upper limit.

      posix_memalign()

      1. 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 .

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      The value of alignment is not a power of 2, or is not a multiple of sizeof(void *).

      ENOMEM

      Insufficient memory.

      pread()

      1. 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:

      Name

      Description

      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()

      1. char* ptsname (int fd)

      Description:

      Obtains the name of a pseudo terminal.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      ERANGE

      fd is too long.

      putenv()

      1. int putenv (char * s)

      Description:

      Configures an environment variable.

      Parameters:

      Name

      Description

      s Indicates the content of the environment variable to configure.

      Returns:

      Returns 0 if the operation is successful; returns -1 otherwise.

      putwc()

      1. 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:

      Name

      Description

      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 only except that it is implemented as a macro.

      Returns:

      Returns the wide character if the operation is successful; returns WEOF otherwise.

      putwchar()

      1. wint_t putwchar (wchar_t wc)

      Description:

      Writes a wide character wc to the stdout.

      Parameters:

      Name

      Description

      wc Indicates the wide character to write.

      Returns:

      Returns the wide character if the operation is successful; returns WEOF otherwise.

      pwrite()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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()

      1. int rand_r (unsigned * seedp)

      Description:

      Generates a pseudo-random number.

      The random number ranges from 0 to RAND_MAX.

      Parameters:

      Name

      Description

      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 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()

      1. long int random (void )

      Description:

      Generates a pseudo-random number.

      Attention:

      Generally, 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()

      1. ssize_t read (int fd, void * buf, size_t size )

      Description:

      Reads the file contents and saves them in a specified buffer location.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EBADF

      fd is invalid.

      EACCES

      The file cannot be read.

      EFAULT

      buf is set to NULL.

      ENOMEM

      Insufficient memory.

      realloc()

      1. 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 , calloc(), or . If the memory block pointed to by ptr has been moved, free(ptr) is executed.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      ENOMEM

      Insufficient memory.

      realpath()

      1. char* realpath (const char *__restrict path, char *__restrict resolved )

      Description:

      Obtains a normalized absolute path.

      Parameters:

      Name

      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.

      errno

      Description

      EACCES

      Read or search permission is denied on a component of the path prefix.

      EINVAL

      path is NULL.

      EIO

      An I/O error occurred while reading from the file system.

      ELOOP

      Too many symbolic links are encountered when the path name is parsed.

      ENAMETOOLONG

      The path name is too long.

      ENOMEM

      Insufficient memory.

      ENOENT

      The file does not exist.

      ENOTDIR

      The component of the path prefix is not a directory.

      remque()

      1. void remque (void * elem)

      Description:

      Removes an entry from a queue.

      Parameters:

      Name

      Description

      element Indicates the element to be removed from the queue.

      rindex()

      1. char* rindex (const char * s, int c )

      Description:

      Searches for the last position of the matched character in a string.

      Parameters:

      Name

      Description

      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()

      1. int rmdir (const char * path)

      Description:

      Deletes a directory.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      path is a null pointer or an empty string.

      ENAMETOOLONG

      The length of the path name is greater than PATH_MAX.

      ENOMEM

      Insufficient memory.

      ENOENT

      The directory does not exist.

      EPERM

      The path is a mount point, or it is neither a directory nor a file.

      ENOSYS

      The operation is not supported.

      ENOTEMPTY

      The directory is not empty.

      ENOTDIR

      The specified path is not a directory.

      ENXIO

      No such device or address.

      sbrk()

      1. void* sbrk (intptr_t increment)

      Description:

      Adjusts the heap size of a process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      ENOMEM

      Insufficient memory.

      secure_getenv()

      1. 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 during non-secure execution.

      Parameters:

      Name

      Description

      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()

      1. unsigned short* seed48 (unsigned short [3])

      Description:

      Generates an evenly distributed pseudo-random seed.

      Parameters:

      Name

      Description

      seed16v Indicates the 48-bit seed.

      Attention:

      This function is an initialization function and can be called before calling , lrand48, or .

      Returns:

      Returns the pointer to the pseudo-random seed.

      setegid()

      1. int setegid (gid_t egid)

      Description:

      Sets the effective user group ID of the calling process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      egid is invalid.

      EPERM

      No setting permission.

      setenv()

      1. 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:

      Name

      Description

      name Indicates the name of environment variable.
      value Indicates the value of environment variable.
      overwrite If the varible name does exit and the value overwrite is nonzero, then value of name will be change to new value; 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

      errno

      Description

      EINVAL

      The name is NULL, or its length is zero, or contains an “=” character.

      ENOMEM

      Insufficient memory.

      seteuid()

      1. int seteuid (uid_t euid)

      Description:

      Sets the effective user ID of the calling process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      euid is invalid.

      EPERM

      No setting permission.

      setgid()

      1. int setgid (gid_t gid)

      Description:

      Sets the user group ID of the calling process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      gid is invalid.

      EPERM

      No setting permission.

      setgroups()

      1. int setgroups (size_t size, const gid_t * list )

      Description:

      Sets the supplementary user group list of the calling process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      size is invalid.

      EFAULT

      Invalid address.

      ENOMEM

      Insufficient memory.

      setpgid()

      1. int setpgid (pid_t pid, pid_t pgid )

      Description:

      Sets the ID of the process group whose process ID is specified by pid.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      Invalid process ID.

      ESRCH

      The specified process cannot be found.

      EPERM

      No permission to operate the process group.

      EACCES

      The child process has performed exec, and the parent process does not have the operation permission.

      setpgrp()

      1. 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()

      1. int setregid (gid_t rgid, gid_t egid )

      Description:

      Sets the real and effective user group IDs of the calling process.

      Parameters:

      Name

      Description

      rgid Indicates the real user group ID to set. If the value is -1, the real user group ID is left unchanged.
      egid Indicates the effective user group ID to set. If the value is -1, the effective user group ID is left unchanged.

      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.

      errno

      Description

      EINVAL

      rgid or egid is invalid.

      EPERM

      No setting permission.

      setresgid()

      1. 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:

      Name

      Description

      rgid Indicates the real user group ID to set. If the value is -1, the real user group ID is left unchanged.
      egid Indicates the effective user group ID to set. If the value is -1, the effective user group ID is left unchanged.
      sgid Indicates the saved group ID to set. If the value is -1, the saved user group ID is left unchanged.

      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.

      errno

      Description

      EINVAL

      rgid, egid, or sgid is invalid.

      EPERM

      No setting permission.

      setresuid()

      1. 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:

      Name

      Description

      ruid Indicates the real user ID to set. If the value is -1, the real user ID is left unchanged.
      euid Indicates the effective user ID to set. If the value is -1, the effective user ID is left unchanged.
      suid Indicates the saved user ID to set. If the value is -1, the saved user ID is left unchanged.

      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.

      errno

      Description

      EINVAL

      ruid, euid, or suid is invalid.

      EPERM

      No setting permission.

      setreuid()

      1. int setreuid (uid_t ruid, uid_t euid )

      Description:

      Sets the real and effective user IDs of the calling process.

      Parameters:

      Name

      Description

      ruid Indicates the real user ID to set. If the value is -1, the real user ID is left unchanged.
      euid Indicates the effective user ID to set. If the value is -1, the effective user ID is left unchanged.

      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.

      errno

      Description

      EINVAL

      ruid or euid is invalid.

      EPERM

      No setting permission.

      setstate()

      1. char* setstate (char * state)

      Description:

      Sets the current state list for subsequent random use.

      Parameters:

      Name

      Description

      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()

      1. int setuid (uid_t uid)

      Description:

      Sets the real user ID for the calling process.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      uid is invalid.

      EPERM

      No setting permission.

      sleep()

      1. 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:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      Incorrect input.

      srand()

      1. void srand (unsigned int seed)

      Description:

      Initializes a random number generator.

      Parameters:

      Name

      Description

      seed Indicates the seed for generating a pseudo-random number.

      Attention:

      If seed is 0, this function is equivalent to srand(1). Before the function is executed, this function is used to initialize different algorithm seeds to generate true random numbers.

      srand48()

      1. void srand48 (long int seedval)

      Description:

      Sets the start seed value for the pseudo-random number generator.

      Parameters:

      Name

      Description

      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()

      1. void srandom (unsigned int seed)

      Description:

      Initializes a random number generator.

      Parameters:

      Name

      Description

      seed Indicates the seed for generating a pseudo-random number.

      stpcpy()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. int strcasecmp (const char * _l, const char * _r )

      Description:

      Compares two strings (string 1 and string 2), regardless of the letter case.

      Parameters:

      Name

      Description

      _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()

      1. char* strcasestr (const char * haystack, const char * needle )

      Description:

      Searches for a needle string in its haystack string and returns a pointer.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* strchr (const char * s, int c )

      Description:

      Locates the first occurrence of a character in a string.

      Parameters:

      Name

      Description

      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()

      1. int strcmp (const char * s1, const char * s2 )

      Description:

      Compares two strings by characters.

      Parameters:

      Name

      Description

      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()

      1. int strcoll (const char * s1, const char * s2 )

      Description:

      Compares two strings by character for the program’s current locale.

      Parameters:

      Name

      Description

      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()

      1. int strcoll_l (const char * s1, const char * s2, locale_t locale )

      Description:

      Compares two strings by character for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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.

      1. char* strdup (const char * s)

      Description:

      Copies a string to a new position.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Returns:

      Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table otherwise.

      errno

      description

      EINVAL

      errnum is invalid.

      strerror_l()

      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:

      Name

      Description

      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.

      errno

      description

      EINVAL

      errnum is invalid.

      ERANGE

      The buffer is insufficient to contain the error description string.

      strerror_r()

      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:

      Name

      Description

      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.

      errno

      description

      EINVAL

      errnum is invalid.

      ERANGE

      The buffer is insufficient to contain the error description string.

      strfmon()

      1. 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:

      Name

      Description

      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 if the operation fails.

      strlcat()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      s Indicates the pointer to the string.

      Returns:

      Returns the string length.

      strncasecmp()

      1. 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:

      Name

      Description

      _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()

      1. 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:

      Name

      Description

      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()

      1. int strncmp (const char * s1, const char * s2, size_t n )

      Description:

      Compares the first n characters of two strings.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* strndup (const char * s, size_t n )

      Description:

      Copies n characters of a string to a new position.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* strrchr (const char * s, int c )

      Description:

      Locates the last occurrence of a character in a string.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* strsignal (int sig)

      Description:

      Returns a string describing the signal number.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. char* strstr (const char * haystack, const char * needle )

      Description:

      Searches for a needle string in its haystack string.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      nptr Indicates the input string.
      endptr Indicates the double pointer to the first unrecognized character.

      Returns:

      Returns the converted value.

      strtof()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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. The common types are 2, 8, 10, and 16, which indicate binary, octal, decimal, and hexadecimal, respectively.

      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 if the value falls out of the floating-point number range.

      strtok()

      1. char* strtok (char * str, const char * delim )

      Description:

      Separates a string into a series of tokens separated by a delimiter.

      Parameters:

      Name

      Description

      str Indicates the pointer to the first token in the string to be separated. This parameter is set to NULL in subsequent calls to this function.
      delim Indicates the pointer to the delimiter used to separate tokens.

      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()

      1. 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:

      Name

      Description

      str Indicates the pointer to the first token in the string to be separated. This parameter is set to NULL in subsequent calls to this function.
      delim Indicates the pointer to the delimiter used to separate tokens.
      saveptr Indicates the double pointer to the char * variable.

      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()

      1. long strtol (const char * nptr, char ** endptr, int base )

      Description:

      Converts a string to a long integer according to the given base.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      nptr Indicates the input string.
      endptr Indicates the double pointer to the first unrecognized character.

      Returns:

      Returns the converted value.

      strtoll()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      s1 Indicates the pointer to string 1 for comparison.
      s2 Indicates the pointer to string 2 for comparison.

      Attention:

      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,

      Input

      Return Value

      The value for s1[x] is equal to that for s2[x].

      The difference between the values

      The values for the first n characters of string 1 and string 2 are the same.

      0

      strxfrm()

      1. 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 , and places them in the destination string pointed to by dest.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      from source array.
      to destination array.
      n number of bytes.

      swprintf()

      1. int swprintf (wchar_t * wcs, size_t maxlen, const wchar_t * format, ... )

      Description:

      Prints formatted data to a specified string.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. void* tdelete (const void * key, void ** rootp, int(*)(const void *, const void *) compar )

      Description:

      Deletes a key from the binary tree.

      Parameters:

      Name

      Description

      key Indicates the pointer to the key to be deleted.
      rootp Indicates the pointer to the root node of the tree. If the tree is empty, the value of this parameter should be NULL.
      compar Indicates the judgment function for searching for a key in the tree.

      Returns:

      Returns the parent pointer to the deleted key if the operation is successful; returns NULL if the operation fails.

      tdestroy()

      1. void tdestroy (void * root, void(*)(void *nodep) free_node )

      Description:

      Releases all nodes in the binary tree.

      Parameters:

      Name

      Description

      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()

      1. void* tfind (const void * key, void *const * rootp, int(*)(const void *, const void *) compar )

      Description:

      Searches for a key in the binary tree.

      Parameters:

      Name

      Description

      key Indicates the pointer to the key to be searched.
      rootp Indicates the pointer to the root node of the tree. If the tree is empty, the value of this parameter should be NULL.
      compar Indicates the judgment function for searching for a key in the tree.

      Returns:

      Returns the parent pointer to the deleted key if the operation is successful; returns NULL if the operation fails.

      toascii()

      1. int toascii (int c)

      Description:

      Converts a parameter of the integer type to an ASCII code.

      Parameters:

      Name

      Description

      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()

      1. int tolower (int c)

      Description:

      Converts an uppercase letter specified by c to its lowercase equivalent.

      Parameters:

      Name

      Description

      c Indicates the parameter to convert.

      Returns:

      Returns the converted letter if the conversion is successful; returns c otherwise.

      tolower_l()

      1. 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:

      Name

      Description

      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()

      1. int toupper (int c)

      Description:

      Converts a lowercase letter specified by c to its uppercase equivalent.

      Parameters:

      Name

      Description

      c Indicates the parameter to convert.

      Returns:

      Returns the converted letter if the conversion is successful; returns c otherwise.

      toupper_l()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      wc Indicates the wide character.
      desc Indicates the mapping relationship, which can be obtained from .

      Returns:

      Returns the translated wide character if the operation is successful; returns WEOF if wc is WEOF.

      towctrans_l()

      1. 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:

      Name

      Description

      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()

      1. wint_t towlower (wint_t wc)

      Description:

      Converts an uppercase wide character to lowercase.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns the lowercase wide character if the conversion is successful; returns wc unchanged otherwise.

      towlower_l()

      1. wint_t towlower_l (wint_t wc, locale_t locale )

      Description:

      Converts an uppercase wide character to lowercase for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. wint_t towupper (wint_t wc)

      Description:

      Converts a lowercase wide character to uppercase.

      Parameters:

      Name

      Description

      wc Indicates the wide character.

      Returns:

      Returns the uppercase wide character if the conversion is successful; returns wc unchanged otherwise.

      towupper_l()

      1. wint_t towupper_l (wint_t wc, locale_t locale )

      Description:

      Converts a lowercase wide character to uppercase for the specified locale.

      Parameters:

      Name

      Description

      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()

      1. int truncate (const char * path, off_t length )

      Description:

      Truncates a file to a specified size based on the file path.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EACCES

      The file has no write permission.

      EBADF

      Failed to open the file in the specified path.

      ENAMETOOLONG

      Failed to open the file because the length of path is greater than PATH_MAX.

      ENOMEM

      Insufficient memory.

      EPERM

      Failed to obtain the file structure corresponding to the file descriptor when opening the file.

      EMFILE

      Failed to open the file because the maximum number of files that can be opened has been reached.

      EINVAL

      The target length is less than 0.

      ENOSYS

      The operation is not supported.

      EPERM

      Failed to obtain the file structure corresponding to the file specified by path, or the file access is rejected.

      tsearch()

      1. 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:

      Name

      Description

      key Indicates the pointer to the key to be searched.
      rootp Indicates the pointer to the root node of the tree. If the tree is empty, the value of this parameter should be NULL.
      compar Indicates the judgment function for searching for a key in the tree.

      twalk()

      1. 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:

      Name

      Description

      root Indicates the pointer to the start node to be searched.
      action Indicates the running function for each node access.
      nodep Indicates the pointer to the node to be accessed.
      which Indicates the value sequence, which is preorder, inorder, postorder, and leaf. For details, see VISIT.
      depth Indicates the depth of the node.

      ualarm()

      1. unsigned ualarm (unsigned value, unsigned interval )

      Description:

      Sets a microsecond-level timer.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      Incorrect input parameter.

      ungetwc()

      1. 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:

      Name

      Description

      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()

      1. int unlink (const char * path)

      Description:

      Deletes a specified file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      path is a null pointer or an empty string.

      ENAMETOOLONG

      The length of the path name is greater than .

      ENOMEM

      Insufficient memory.

      ENOENT

      The file does not exist.

      ENOSYS

      The operation is not supported.

      ENOTEMPTY

      The path is a pseudo file used as a directory, or the directory is not empty.

      EISDIR

      The specified path is a directory.

      ENXIO

      No such device or address.

      EACCES

      The search permission on the path prefix component is denied, or the write permission of the directory in the path is denied.

      unlinkat()

      1. int unlinkat (int fd, const char * path, int flag )

      Description:

      Deletes a specified file.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      path is a null pointer or an empty string.

      ENAMETOOLONG

      The length of the path name is greater than NAME_MAX.

      ENOMEM

      Insufficient memory.

      ENOENT

      The file does not exist.

      ENOSYS

      The operation is not supported.

      ENOTEMPTY

      The path is a pseudo file used as a directory, or the directory is not empty.

      EISDIR

      The specified path is a directory.

      ENXIO

      No such device or address.

      EACCES

      The search permission on the path prefix component is denied, or the write permission of the directory in the path is denied.

      unlockpt()

      1. int unlockpt (int fd)

      Description:

      Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      EBADF

      Invalid descriptor

      EINVAL

      fd is invalid.

      unsetenv()

      1. int unsetenv (const char * name)

      Description:

      Deletes an environment variable.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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.

      errno

      Description

      EINVAL

      Incorrect input parameter.

      valloc()

      1. void* valloc (size_t size)

      Description:

      Allocates memory with the specified size and aligns the allocated memory by page size.

      Parameters:

      Name

      Description

      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.

      errno

      Description

      ENOMEM

      Insufficient memory.

      vfwprintf()

      1. 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:

      Name

      Description

      stream Indicates the pointer to a file object that identifies an output stream.
      format Indicates the pointer to the wide character 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 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()

      1. 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:

      Name

      Description

      stream Indicates the pointer to a file object that identifies an output stream.
      format Indicates the pointer to the wide character 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 and va_end and is the wide character equivalent of the 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()

      1. 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:

      Name

      Description

      wcs Indicates the pointer to the destination wide character string.
      maxlen Indicates the maximum length of the destination wide character string.
      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:

      The destination wide character string must end with the terminating null character ‘\0’. This function is generally used together with and va_end and is the wide character equivalent of the 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()

      1. 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:

      Name

      Description

      ws Indicates the pointer to the wide character string to read.
      format Indicates the pointer to the wide character 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 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 .

      vwprintf()

      1. int vwprintf (const wchar_t * format, va_list args )

      Description:

      Prints formatted data from a variable argument list to the standard output (stdout).

      Parameters:

      Name

      Description

      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 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()

      1. 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:

      Name

      Description

      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 and va_end and is the wide character equivalent of the 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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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 if the operation fails.

      wcscasecmp()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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) + (src) + 1).

      Returns:

      Returns the pointer to the destination string after concatenation.

      wcschr()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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 .

      Parameters:

      Name

      Description

      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 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()

      1. 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:

      Name

      Description

      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()

      1. 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()

      1. 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:

      Name

      Description

      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()

      1. wchar_t* wcsdup (const wchar_t * s)

      Description:

      Copies a specified wide character string to a newly allocated buffer.

      Parameters:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      wcs Indicates the pointer to the wide character array to accommodate the converted string.
      n Indicates the size of the buffer for the wide character array.
      f Indicates the pointer to the required format.
      tm Indicates the pointer to the broken-down time in the tm structure.

      Returns:

      Returns the number of bytes in the string if the conversion is successful; returns 0 otherwise.

      wcslen()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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 ( (dest) + n + 1).

      Returns:

      Returns the pointer to the destination string after concatenation.

      wcsncmp()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      dest Indicates the pointer to character array to accommodate the character string.
      src Indicates the double pointer to the source wide character string to be converted.
      nwc Indicates the number of wide characters to be converted.
      len Indicates the maximum number of bytes to be written to the destination string.
      ps Indicates the pointer to the mbstate_t object describing the conversion state.

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      dest Indicates the pointer to the character string array to accommodate the multi-byte string.
      src Indicates the double pointer to the source string to be converted.
      len Indicates the maximum number of bytes to be written to the destination string array.
      ps Indicates the pointer to the mbstate_t object describing the conversion state.

      Returns:

      Returns the number of converted bytes, excluding the terminating null byte ‘\0’ if the operation is successful; returns -1 and sets errno to if the operation fails.

      wcsspn()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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 .

      wcstof()

      1. 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:

      Name

      Description

      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 .

      wcstoimax()

      1. 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:

      Name

      Description

      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 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()

      1. 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:

      Name

      Description

      wcs Indicates the pointer to the first token in the wide character string to be split. This parameter is set to NULL in subsequent calls to this function.
      delim Indicates the pointer to the delimiter used to split tokens.
      ptr Indicates the double pointer to the rest part in the source string after splitting.

      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()

      1. 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:

      Name

      Description

      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 value.
      base Indicates the base of the converted 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 . If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.

      wcstold()

      1. 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:

      Name

      Description

      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 .

      wcstoll()

      1. 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:

      Name

      Description

      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 long value.
      base Indicates the base of the converted value.

      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 . If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.

      wcstombs()

      1. size_t wcstombs (char * dest, const wchar_t * src, size_t n )

      Description:

      Converts a wide-character string to a multi-byte string.

      Parameters:

      Name

      Description

      dest Indicates the pointer to the destination string, which must have sufficient space, as specified by n.
      src Indicates the pointer to the wide-character string to be converted.
      n Indicates the maximum number of bytes to be written to the destination string.

      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()

      1. 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:

      Name

      Description

      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 unsigned long value.
      base Indicates the base of the converted value.

      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 . If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.

      wcstoull()

      1. 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:

      Name

      Description

      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 unsigned long long value.
      base Indicates the base of the converted value.

      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 . If the correct value would cause an underflow, this function returns a value no greater than the smallest normalized positive number.

      wcstoumax()

      1. 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:

      Name

      Description

      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 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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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:

      Input

      Return Value

      s is not NULL.

      The number of bytes written to the byte array.

      wc cannot be represented as a multi-byte sequence.

      -1.

      s is NULL.

      A non-zero value if the code has shift state or 0 if the code is stateless.

      wctrans()

      1. [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

      Description

      name Indicates the mapping name. The value can only be tolower (converting an uppercase wide character to lowercase) or (converting a lowercase wide character to uppercase).

      Returns:

      Returns the mapping corresponding to name if the operation is successful; returns 0 otherwise.

      wctrans_l()

      1. [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 locale, the mapping is returned based on the name parameter.

      Parameters:

      Name

      Description

      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).
      locale Indicates the locale. This parameter is ignored currently.

      Returns:

      Returns the mapping corresponding to name if the operation is successful; returns 0 otherwise.

      wctype()

      1. wctype_t wctype (const char * name)

      Description:

      Checks whether a wide character type exists in the LC_CTYPE locale.

      Parameters:

      Name

      Description

      name Indicates the pointer to the wide character type.

      Attention:

      The wide character types are as follows:

      Type

      Description

      alnum

      Letters and digits

      alpha

      Letters

      cntrl

      Control characters

      digit

      Decimal digits

      graph

      Visible characters

      lower

      Lowercase letters

      print

      Printable characters

      punct

      Punctuation marks

      space

      Space

      upper

      Uppercase letters

      xdigit

      Hexadecimal digits

      Returns:

      Returns the type descriptor if the check is successful; returns 0 otherwise.

      wctype_l()

      1. wctype_t wctype_l (const char * name, locale_t locale )

      Description:

      Checks whether a wide character type exists for the specified locale.

      Parameters:

      Name

      Description

      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:

      Type

      Description

      alnum

      Letters and digits

      alpha

      Letters

      cntrl

      Control characters

      digit

      Decimal digits

      graph

      Visible characters

      lower

      Lowercase letters

      print

      Printable characters

      punct

      Punctuation marks

      space

      Space

      upper

      Uppercase letters

      xdigit

      Hexadecimal digits

      Returns:

      Returns the type descriptor if the check is successful; returns 0 otherwise.

      wmemchr()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

      1. 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:

      Name

      Description

      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()

        Description:

        Prints formatted data to the standard output (stdout).

        Parameters:

        Name

        Description

        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()

        Description:

        Writes the specified content to the file.

        Parameters:

        Name

        Description

        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.

        errno

        Description

        EBADF

        fd is invalid.

        EACCES

        The file cannot be written.

        EFAULT

        buf is an inaccessible address.

        EAGAIN

        O_NONBLOCK is used to select non-blocking I/O, and the write would block.

        ENOSYS

        The operation is not supported.

        EINVAL

        The current position of the file pointer is less than 0.

        ENOSPC

        The storage device to which the file is written has no space.

        ENOMEM

        Insufficient memory.

        EFBIG

        An attempt is made to write a file whose length is greater than the defined maximum file size.

        wscanf()

        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:

        Name

        Description

        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 .