strncat
char *  strncat ( char * dest, const char * src, sizet_t num );
string.h
  cplusplus.com  

Append substring to string.
  Appends num characters of src string to dest string. If the terminating null-character appears in src string before num character have been appended, the function appends the null-character to dest and ends.
  The terminating null character in dest is overwritten by the first character of src. The resulting string includes a null-character at end.

Parameters.

dest
Pointer to a null-terminated string with enough space allocated to contain src plus num characters.
src
Null-terminated string containing characters to be appended.
num
Number of characters to be appended from src to dest.

Return Value.
  dest is returned.

Portability.
  Defined in ANSI-C.

Example.

/* strncat example */
#include <stdio.h>
#include <string.h>

main ()
{
  char str1[20];
  char str2[20];
  strcpy (str1,"To be ");
  strcpy (str2,"or not to be");
  strncat (str1, str2, 6);
  puts (str1);
  return 0;
}
Output:
To be or not

See also.
  strcat, strcpy, strncpy strset, memcpy


© The C++ Resources Network, 2000