Name

stpcpy — copy a string from src to dest returning a pointer to the new end of dest, including src's NUL-terminator. May overrun dest.

Synopsis

char * stpcpy (char *__restrict__ dest,
 const char *__restrict__ src);
 

Arguments

dest

pointer to end of string being copied into. Must be large enough to receive copy.

src

pointer to the beginning of string being copied from. Must not overlap dest.

stpcpy differs from strcpy in a key way

the return value is a pointer to the new NUL-terminating character in dest. (For strcpy, the return value is a pointer to the start of dest). This interface is considered unsafe as it doesn't perform bounds checking of the inputs. As such it's not recommended for usage. Instead, its definition is provided in case the compiler lowers other libcalls to stpcpy.