strncat
Appends a specified number of characters of one string to another string
#include <string.h> char *strncat ( char *dst, const char *src, size_t n);
The strncat function returns the value of dst.
The strncat function appends not more than n characters of the string pointed to by src to the end of the string pointed to by dst. The first character of src overwrites the NULL character at the end of dst. A terminating NULL character is always appended to the result.
#include <string.h> #include <stdio.h> char buffer[80]; main () { strcpy (buffer, "Hello "); strncat (buffer,"world", 8); printf ("%s\n", buffer); strncat (buffer, "*************", 4); printf ("%s\n", buffer); }
produces the following:
Hello world Hello world****