|
🧵 str
Painfully common string utilities for C
|
#include <stddef.h>Go to the source code of this file.
Functions | |
| ptrdiff_t | strzcpy (char *restrict dest, const char *restrict src, size_t size) |
| Similar to strncpy(), except result is always null-terminated. | |
| ptrdiff_t | strzcat (char *restrict dest, const char *restrict src, size_t size) |
| Similar to strncat(), except result is always null-terminated. | |
| char * | strdup (const char *src) |
| Duplicates a null-terminated string. | |
| char * | strndup (const char *src, size_t size) |
| Duplicates a null-terminated string, up to a maximum length. | |
| char * strdup | ( | const char * | src | ) |
Duplicates a null-terminated string.
The returned string can be passed into free() to destroy it.
| src | The null-terminated string to duplicate. |
| char * strndup | ( | const char * | src, |
| size_t | size ) |
Duplicates a null-terminated string, up to a maximum length.
If a null terminator is not encountered in the first size bytes, it is appended to the duplicated string.
The returned string can be passed into free() to destroy it.
| src | The null-terminated string to duplicate. |
| size | The maximum number of bytes to copy from src. |
| ptrdiff_t strzcat | ( | char *restrict | dest, |
| const char *restrict | src, | ||
| size_t | size ) |
Similar to strncat(), except result is always null-terminated.
| dest | Pointer to the null-terminated string to append to |
| src | Pointer to the buffer to copy from |
| size | The maximum permitted length of the string in dest, including the null terminator. |
| ptrdiff_t strzcpy | ( | char *restrict | dest, |
| const char *restrict | src, | ||
| size_t | size ) |
Similar to strncpy(), except result is always null-terminated.
| dest | Pointer to the buffer to copy to |
| src | Pointer to the buffer to copy from |
| size | The maximum permitted length of the string in dest, including the null terminator. |