PMSTRNCAT(3) | Library Functions Manual | PMSTRNCAT(3) |
pmstrncat - safe string concatenation
#include <pcp/pmapi.h>
int pmstrncat(char *dest, size_t destlen, char *src);
cc ... -lpcp
pmstrncat is safe string concatenation routine with semantics similar to strncat(3).
The main differences are that src must be null-byte terminated, destlen is the length of the destination buffer (dest) not the length of the source string (src), and pmstrncat ensures that dest is null-byte terminated, even when strlen(src) is larger than the remaining space in dest (destlen - strlen(dest) on entry).
On success, pmstrncat returns 0, else -1 indicates that src is too big and the result been truncated to ensure dest has no been overrun.
pmstrncpy(3) and strncat(3).
PCP | Performance Co-Pilot |