strncat, _fstrncat

Description

Append characters of a string.

#include <string.h> Required only for function declarations  

char *strncat( char *string1, const char *string2, size_t count );

char __far * __far _fstrncat( char __far *string1, const char __far *string2,
size_t count );

string1 Destination string  
string2 Source string  
count Number of characters appended  

Remarks

The strncat and _fstrncat functions append, at most, the first count characters of string2 to string1, terminate the resulting string with a null character ('\0'), and return a pointer to the concatenated string (string1). If count is greater than the length of string2, the length of string2 is used in place of count.

The _fstrncat function is a model-independent (large-model) form of the strncat function. The behavior and return value of _fstrncat are identical to those of the model-dependent function strncat, with the exception that all the pointer arguments and return values are far pointers.

Return Value

The return values for these functions are described above.

Compatibility

strncat

Standards:ANSI, UNIX

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

_fstrncat

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

strcat, strcmp, strcpy, strncmp, strncpy, _strnicmp, strrchr, _strset, strspn

Example

/* STRNCAT.C */

#include <string.h>

#include <stdio.h>

void main( void )

{

char string[80] = "This is the initial string!";

char suffix[] = " extra text to add to the string...";

/* Combine strings with no more than 19 characters of suffix: */

printf( "Before: %s\n", string );

strncat( string, suffix, 19 );

printf( "After: %s\n", string );

}

Output

Before: This is the initial string!

After: This is the initial string! extra text to add