|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This header provides functions for handlingnull-terminated byte strings.
Macros | ||
| implementation-defined null pointer constant (macro constant)[edit] | ||
Types | ||
| unsigned integer type returned by thesizeof operator (typedef)[edit] | ||
Functions | ||
String manipulation | ||
(C11) | copies one string to another (function)[edit] | |
(C11) | copies a certain amount of characters from one string to another (function)[edit] | |
(C11) | concatenates two strings (function)[edit] | |
(C11) | concatenates a certain amount of characters of two strings (function)[edit] | |
| transform a string so that strcmp would produce the same result as strcoll (function)[edit] | ||
(C23) | allocates a copy of a string (function)[edit] | |
(C23) | allocates a copy of a string of specified size (function)[edit] | |
String examination | ||
(C11) | returns the length of a given string (function)[edit] | |
| compares two strings (function)[edit] | ||
| compares a certain amount of characters of two strings (function)[edit] | ||
| compares two strings in accordance to the current locale (function)[edit] | ||
| finds the first occurrence of a character (function)[edit] | ||
| finds the last occurrence of a character (function)[edit] | ||
| returns the length of the maximum initial segment that consists of only the characters found in another byte string (function)[edit] | ||
| returns the length of the maximum initial segment that consists of only the characters not found in another byte string (function)[edit] | ||
| finds the first location of any character in one string, in another string (function)[edit] | ||
| finds the first occurrence of a substring of characters (function)[edit] | ||
(C11) | finds the next token in a byte string (function)[edit] | |
Character array manipulation | ||
| searches an array for the first occurrence of a character (function)[edit] | ||
| compares two buffers (function)[edit] | ||
(C23)(C11) | fills a buffer with a character (function)[edit] | |
(C11) | copies one buffer to another (function)[edit] | |
(C11) | moves one buffer to another (function)[edit] | |
(C23) | copies one buffer to another, stopping after the specified delimiter (function)[edit] | |
Miscellaneous | ||
(C11)(C11) | returns a text version of a given error code (function)[edit] | |
#define __STDC_VERSION_STRING_H__ 202311L #define NULL /* see description */ typedef/* see description */size_t; void*memcpy(void*restrict s1,constvoid*restrict s2,size_t n);void* memccpy(void*restrict s1,constvoid*restrict s2,int c,size_t n);void*memmove(void* s1,constvoid* s2,size_t n);char*strcpy(char*restrict s1,constchar*restrict s2);char*strncpy(char*restrict s1,constchar*restrict s2,size_t n);char* strdup(constchar* s);char* strndup(constchar* s,size_t n);char*strcat(char*restrict s1,constchar*restrict s2);char*strncat(char*restrict s1,constchar*restrict s2,size_t n);intmemcmp(constvoid* s1,constvoid* s2,size_t n);intstrcmp(constchar* s1,constchar* s2);intstrcoll(constchar* s1,constchar* s2);intstrncmp(constchar* s1,constchar* s2,size_t n);size_tstrxfrm(char*restrict s1,constchar*restrict s2,size_t n);/*QVoid*/*memchr(/*QVoid*/* s,int c,size_t n);/*QChar*/*strchr(/*QChar*/* s,int c);size_tstrcspn(constchar* s1,constchar* s2);/*QChar*/*strpbrk(/*QChar*/* s1,constchar* s2);/*QChar*/*strrchr(/*QChar*/* s,int c);size_tstrspn(constchar* s1,constchar* s2);/*QChar*/*strstr(/*QChar*/* s1,constchar* s2);char*strtok(char*restrict s1,constchar*restrict s2);void*memset(void* s,int c,size_t n);void* memset_explicit(void* s,int c,size_t n);char*strerror(int errnum);size_tstrlen(constchar* s);size_t strnlen(constchar* s,size_t n);
Only if the implementation defines__STDC_LIB_EXT1__ and additionally the user code defines__STDC_WANT_LIB_EXT1__ before any inclusion of<string.h>:
#ifdef __STDC_WANT_LIB_EXT1__ tyepdef/* see description */ errno_t;tyepdef/* see description */ rsize_t; errno_t memcpy_s(void*restrict s1, rsize_t s1max,constvoid*restrict s2, rsize_t n);errno_t memmove_s(void* s1, rsize_t s1max,constvoid* s2, rsize_t n);errno_t strcpy_s(char*restrict s1, rsize_t s1max,constchar*restrict s2);errno_t strncpy_s(char*restrict s1, rsize_t s1max,constchar*restrict s2, rsize_t n);errno_t strcat_s(char*restrict s1, rsize_t s1max,constchar*restrict s2);errno_t strncat_s(char*restrict s1, rsize_t s1max,constchar*restrict s2, rsize_t n);char* strtok_s(char*restrict s1, rsize_t*restrict s1max,constchar*restrict s2,char**restrict ptr);errno_t memset_s(void* s, rsize_t smax,int c, rsize_t n)errno_t strerror_s(char* s, rsize_t maxsize, errno_t errnum);size_t strerrorlen_s(errno_t errnum);size_t strnlen_s(constchar* s,size_t maxsize); #endif