Name |
Notes |
void *memcpy(void *dest, const void *src, size_t n); |
copies n bytes between two memory areas, which must not overlap |
void *memmove(void *dest, const void *src, size_t n); |
copies n bytes between two memory areas; unlike with memcpy the areas may overlap |
void *memchr(const void *s, int c, size_t n); |
returns a pointer to the first occurrence of c in the first n bytes of s, or NULL if not found |
int memcmp(const void *s1, const void *s2, size_t n); |
compares the first n characters of two memory areas |
void *memset(void *, int, size_t); |
overwrites a memory area with a byte pattern |
char *strcat(char *dest, const char *src); |
appends the string src to dest |
char *strncat(char *, const char *, size_t); |
appends at most n characters of the string src to dest |
char *strchr(const char *, int); |
locates a character in a string, searching from the beginning |
char *strrchr(const char *, int); |
locates a character in a string, searching from the end |
int strcmp(const char *, const char *); |
compares two strings numerically |
int strncmp(const char *, const char *, size_t); |
compares up to the first n bytes of two strings numerically |
int strcoll(const char *, const char *); |
compares two strings using the current locale's collating order |
char *strcpy(char *toHere, const char *fromHere); |
copies a string from one location to another |
char *strncpy(char *toHere, const char *fromHere, size_t); |
copies up to n bytes of a string from one location to another |
char *strerror(int); |
returns the string representation of an error number e.g. errno (not thread-safe) |
size_t strlen(const char *); |
finds the length of a C string |
size_t strspn(const char *s, const char *accept); |
determines the length of the maximal initial substring of s consisting entirely of characters in accept |
size_t strcspn(const char *s, const char *reject); |
determines the length of the maximal initial substring of s consisting entirely of characters not in reject |
char *strpbrk(const char *s, const char *accept); |
finds the first occurrence of any character in accept in s |
char *strstr(const char *haystack, const char *needle); |
finds the first occurrence of the string "needle" in the longer string "haystack". |
char *strtok(char *, const char *); |
parses a string into a sequence of tokens; non-thread safe in the spec, non-reentrant |
size_t strxfrm(char *dest, const char *src, size_t n); |
transforms src into a collating form, such that the numerical sort order of the transformed string is equivalent to the collating order of src. |
Name |
Notes |
Specification |
char *strdup(const char *); |
allocates and duplicates a string into memory |
POSIX; originally a BSD extension |
errno_t strcpy_s(char *restrict s1, rsize_t s1max, const char *restrict s2); |
bounds-checked variant of strcpy |
ISO/IEC WDTR 24731 |
void *mempcpy(void *dest, const void *src, size_t n); |
variant of memcpy returning a pointer to the byte following the last written byte |
GNU |
void *memccpy(void *dest, const void *src, int c, size_t n
);
|
copies up to n bytes between two memory areas, which must not overlap, stopping when the byte c is found |
UNIX 98? |
int *strerror_r(int, char *, size_t); |
returns the string representation of an error number e.g. errno (thread-safe; some differences in semantics between GNU and XSI/POSIX) |
GNU, POSIX |
size_t strlcpy(char *dest, const char *src, size_t n); |
bounds-checked variant of strcpy |
originally OpenBSD, now also FreeBSD, Solaris, Mac OS X |
char *strtok_r(char *, const char *, char **); |
thread-safe version of strtok |
POSIX |
char *strsignal(int sig); |
by analogy to strerror , returns string representation of the signal sig (not thread safe) |
BSDs, Solaris, Linux |