|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <wchar.h> | ||
| (1) | ||
wchar_t*wcsncat(wchar_t*dest,constwchar_t*src,size_t count); | (since C95) (until C99) | |
wchar_t*wcsncat(wchar_t*restrict dest, constwchar_t*restrict src,size_t count); | (since C99) | |
errno_t wcsncat_s(wchar_t*restrict dest, rsize_t destsz, constwchar_t*restrict src, rsize_t count); | (2) | (since C11) |
count wide characters from the wide string pointed to bysrc, stopping if the null terminator is copied, to the end of the character string pointed to bydest. The wide charactersrc[0] replaces the null terminator at the end ofdest. The null terminator is always appended in the end (so the maximum number of wide characters the function may write iscount+1).str anddest and the terminating null wide character.destsz) and that the following errors are detected at runtime and call the currently installedconstraint handler function:src ordest is a null pointerdestsz orcount is zero or greater thanRSIZE_MAX/sizeof(wchar_t)destsz wide characters ofdestcount or the length ofsrc, whichever is less, exceeds the space available between the null terminator ofdest anddestsz.wcsncat_s is only guaranteed to be available if__STDC_LIB_EXT1__ is defined by the implementation and if the user defines__STDC_WANT_LIB_EXT1__ to the integer constant1 before including<wchar.h>.Contents |
| dest | - | pointer to the null-terminated wide string to append to |
| src | - | pointer to the null-terminated wide string to copy from |
| count | - | maximum number of wide characters to copy |
| destsz | - | the size of the destination buffer |
destdest is a null pointer ordestsz is zero or greater thanRSIZE_MAX/sizeof(wchar_t)).Although truncation to fit the destination buffer is a security risk and therefore a runtime constraints violation forwcsncat_s, it is possible to get the truncating behavior by specifyingcount equal to the size of the destination array minus one: it will copy the firstcount wide characters and append the null terminator as always:wcsncat_s(dst,sizeof dst/sizeof*dst, src,(sizeof dst/sizeof*dst)-wcsnlen_s(dst,sizeof dst/sizeof*dst)-1);
Possible output:
Земля, прощай. В добрый
(C95)(C11) | appends a copy of one wide string to another (function)[edit] |
(C11) | concatenates a certain amount of characters of two strings (function)[edit] |
(C95)(C11) | copies one wide string to another (function)[edit] |
C++ documentation forwcsncat | |