strncat [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
strncat
Appends a copy of string 2 to string 1.
Syntax
#include <string.h>
char *strncat(char *s1, const char *s2, size_t n);
Parameters
s1 A pointer to a destination.
s2 A pointer to a null-terminated source character string.
n The maximum number of characters to concatenate from s2 to
s1, unless strncat() first encounters a null terminator in
s2.
Return Values
x The address of s1.
Description
In the strncat function, s1 and s2 are character pointers to
null-terminated character strings.
The strncat function is similar to strcat(), except that at most n
characters are appended to s1 (or up to a null character, whichever comes
first). Note that string s2 need not be null-terminated when using
strncat() if n is less than or equal to the length of s2. This function
returns a character pointer to the null-terminated result. The first
character of s2 overwrites the null terminator of s1. A terminating null
is appended to the result.
This function does not check if there is room in s1 for the additional
characters of s2. Thus, to be safe, s1 should always be a declared array
having plenty of space for the additional characters of s2, plus a
terminating null character.
See Also
strcat(), strcpy(), strncpy(), ANSI C 4.11.3.2, POSIX.1 8.1
MPE/iX 5.0 Documentation