strncat, _fstrncat

concatenate two strings, up to a maximum length

Synopsis:

#include <string.h>
char *strncat( char *dst,
               const char *src,
               size_t n );
char __far *_fstrncat( char __far *dst,
                       const char __far *src,
                       size_t n );

Description:

The strncat() and _fstrncat() functions append no 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.

The _fstrncat() function is a data-model-independent form of the strncat() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.

Returns:

the value of dst

See also:

strcat()

Examples:

#include <stdio.h>
#include <string.h>

char buffer[80];

void main()
  {
    strcpy( buffer, "Hello " );
    strncat( buffer, "world", 8 );
    printf( "%s\n", buffer );
    strncat( buffer, "*************", 4 );
    printf( "%s\n", buffer );
  }

produces the output:

Hello world
Hello world****

Classification:

strncat() is ANSI; _fstrncat() is WATCOM.

Systems:

strncat()
All (except DOS/PM)
_fstrncat()
All (except Netware, DOS/PM)