strncat


Character string concatenation with number of characters specified

[Classification]

Standard library

[Syntax]

#include <string.h>

char __near * __far strncat(char __near *s1, const char __near *s2, size_t n); (C90)

char __near * __far strncat(char __near * restrict s1, const char __near * restrict s2, size_t n); (C99) [V1.07 or later]

char __far * __far _COM_strncat_ff(char __far *s1, const char __far *s2, size_t n); (C90)

char __far * __far _COM_strncat_ff(char __far * restrict s1, const char __far * restrict s2, size_t n); (C99) [V1.07 or later]

 

[Return value]

Returns the value of s1.

[Description]

This function concatenates up to n characters (null character and string following the null character are not appended) to the end of the character string indicated by s1, starting from the beginning of the array indicated by s2. The null character (\0) at the end of s1 is written over the first character of s2. The null character indicating termination (\0) is always added to this result.

The operation is undefined if the copy source and copy destination areas overlap.

[Caution]

Because the null character (\0) is always appended when strncat is used, if copying is limited by the number of n arguments, the number of characters appended to s1 is n + 1.