Appends characters to a string.
#include <string.h> char *strncat (char *string1, const char *string2 size_t count);
errno_t strncat_s(char * restrict string1, rsize_t s1max, const char * restrict string2, rsize_t count);
#include <wchar.h>
wchar_t *wcsncat(wchar_t *string1, const wchar_t *string2, size_t count);
errno_t wcsncat_s(wchar_t *string1, size_t ds1max, const wchar_t *string2, size_t count);
string1
s1max
string2
count
The strncat function appends at most the first count characters of string2
to string1
and terminates the resulting string with a null character. If count is greater than the length of string2
, the length of string2
is used in place of count.
The strncat_s function appends not more than count successive characters (characters that follow a null character are not copied) from the array pointed to by string2 to the end of the string pointed to by string1. The initial character from string2 overwrites the null character at the end of string1. If no null character was copied from string2, then string1[s1max-m+count] is set to a null character.
The strncat_s function is subject to runtime contraints:
If there is a runtime-constraint violation, then if string1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then strncat_s sets string1[0] to the null character.
wcsncat and wcsncat_s are the wide-character versions of strncat and strncat_s.
A pointer to the concatenated string.
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
---|---|---|
_tcsncat | strncat | _wcsncat |
_tcsncat_s | strncat_s | _wcsncat_s |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 |
intime/rt/include/string.h intime/rt/include/wchar.h intime/rt/include/tchar.h |
string.h wchar.h tchar.h |
clib.lib |