StrnCat
This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.
Syntax
void strncat(char dest[], char src[], long len);
Function
This function appendssrctodest.lenindicates the maximum length of the composite string. The function ensures that there is a terminating "\0". Thus, a maximum oflen - strlen(dest) - 1characters are copied.
Parameters
dest Target string to which characters are appended.
src
Appended string.
len
Maximum length of composite string including terminating '\0'.
Return Values
—
Reference example from the CANoe 12 help. Check the required configuration, database objects and API availability in your installed version; this is not a recorded compiler or runtime test.
char s[20];
strncpy(s, "Vector", 10); // s is "Vector"
strncat(s, " CANoe", 19); // s is "Vector CANoe"
strncpy(s, "Vector", 10); // s is "Vector"
strncat(s, " CANoe", 11); // s is "Vector CAN"