pmstrncpy - Man Page

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).

Referenced By

pmstrncat(3).

PCP Performance Co-Pilot