![]() |
![]()
| ![]() |
![]()
NAMExt_strcpy() - Copy a string without risk of buffer overflow LIBRARY#include <xtend/string.h> -lxtend SYNOPSISsize_t xt_strlcpy(char * restrict dest, const char * restrict src, size_t dstsize) ARGUMENTSdest: Pointer to a character array of at least len dstsize, where the possibly modified string is stored. src: Point to a character array containing the string to compact dstsize: Length of the dest array DESCRIPTIONCopy string src to dest, truncating to a maximum length of dstsize if necessary. RETURN VALUESThe length of the source string. If the return value is larger than the dstsize, then truncation has occurred. EXAMPLES#define MAXLEN 127 char limited_str[MAXLEN + 1], SEE ALSOxt_strlsqueeze(3), xt_strlcat(3)
|