welibc
A clear, secure, and well documented standard C library
Functions
strncat.c File Reference

Defines the strncat function. More...

#include <string.h>
Include dependency graph for strncat.c:

Go to the source code of this file.

Functions

char * strncat (char *s1, const char *s2, size_t n)
 Concatenates two strings, appending no more than n characters. More...
 

Detailed Description

Defines the strncat function.

Definition in file strncat.c.

Function Documentation

◆ strncat()

char* strncat ( char *  s1,
const char *  s2,
size_t  n 
)

Concatenates two strings, appending no more than n characters.

Parameters
*s1Destination string
*s2String to be appended
nMaximum number of characters to append

The strncat function appends not more than n characters (a null character and characters that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial character of s2 overwrites the null character at the end of s1. A terminating null character is always appended to the result. If copying takes place between objects that overlap, the behavior is undefined.

Note
The maximum number of characters that can end up in the array pointed to be s1 is strlen(s1)+n+1.
Copying between overlapping objects is supported, but the source may be overwritten.
Returns
The value of s1

Definition at line 62 of file strncat.c.

References memmove(), and strlen().

Here is the call graph for this function: