Guardian C Library Calls Reference Manual
strncat
3-202 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
strncat
The strncat function concatenates not more than a specified number of characters from
one string to another.
str1_ptr
points to the string to append to.
str2_ptr
points to the string that is concatenated to the first string.
max
specifies the maximum number of characters from *str2_ptr to append to *str1_ptr.
max must be a positive integer.
Return Value
points to the resulting string.
Example
This example prints “BEATLES: It was twenty years ago today!”:
#include <stringh>
#include <stdioh>
int main(void)
{
char str1[50], *str2, *str3;
str1[0] = 'B';
str1[1] = 'E';
str1[2] = 'A';
str1[3] = 'T';
str1[4] = 'L';
str1[5] = 'E';
str1[6] = 'S';
str1[7] = ':';
str1[8] = ' ';
str1[9] = NULL;
str2 ="It was twenty years ago today! Yeah!";
str3 = strncat(str1,str2,31);
printf("%s\n",str3);
}
#include <stringh>
char *strncat(char *str1_ptr, const char *str2_ptr,
size_t max);