[Previous]
[Contents]
[Next]

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() function appends 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 (but isn't counted as part of n).

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

Returns:

The value of dst.

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.
Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

strcat()


[Previous]
[Contents]
[Next]