table of contents
- bookworm 6.0.3-1.1
- testing 6.2.0-1
- unstable 6.2.0-1.1+b1
- experimental 6.2.0-1.1~exp1
PMSTRNCPY(3) | Library Functions Manual | PMSTRNCPY(3) |
NAME¶
pmstrncpy - safe string copy
C SYNOPSIS¶
#include <pcp/pmapi.h>
int pmstrncpy(char *dest, size_t destlen, char *src);
cc ... -lpcp
DESCRIPTION¶
pmstrncpy is safe string copying routine with semantics similar to strncpy(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 pmstrncpy ensures that dest is null-byte terminated, even when strlen(src) is larger than destlen.
On success, pmstrncpy returns 0, else -1 indicates that src is too big and the result been truncated to ensure dest has no been overrun.
SEE ALSO¶
pmstrncat(3) and strncpy(3).
PCP | Performance Co-Pilot |