---
name: "rtapi_strlcpy"
section: "3rtapi"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rtapi_strlcpy"
---

# rtapi\_strlcpy(3rtapi)

RTAPI string manipulation functions

## NAME

rtapi\_strlcpy - RTAPI string manipulation functions

## SYNTAX

\#include \<rtapi\_string.h\>

size\_t rtapi\_strlcpy(char \*dst, const char \*src, size\_t sz); #define rtapi\_strxcpy(dst, src) ... size\_t rtapi\_strlcat(char \*dst, const char \*src, size\_t sz); #define rtapi\_strxcat(dst, src) ...

## DESCRIPTION

rtapi\_strlcpy will copy at most 'sz' chars from 'src' to 'dst'. Always leaves 'dst' NUL-terminated except if sz is 0.

rtapi\_strxcpy(dst, src) checks that dst is an array with known size, and calls rtapi\_strlcpy(dst, src, sizeof(dst)).  If it is not an array with a known size, it is a (possibly cryptic!) syntax error.

rtapi\_strlcat will append characters from 'src' to 'dst', stopping when the end of 'src' is reached, or 'dst' uses 'sz' bytes of storage including the trialing nul.

rtapi\_strxcat(dst, src) checks that dst is an array with known size, and calls rtapi\_strlcat(dst, src, sizeof(dst)).  If it is not an array with a known size, it is a (possibly cryptic!) syntax error.

## RETURN VALUE

The total length of the string strlcpy or strlcat tried to create. For strlcpy() that means the length of src.  If the return value is greater than or equal to sz, the result was truncated.

## SEE ALSO

[strlcpy(3bsd)](/strlcpy/3bsd.md), [strlcat(3bsd)](/strlcat/3bsd.md)
