function
<cwchar>

wcsncat

wchar_t* wcsncat (wchar_t* destination, const wchar_t* source, size_t num);
Append characters from wide string
Appends the first num wide characters of source to destination, plus a terminating null wide character.

If the length of the C wide string in source is less than num, only the content up to the terminating null wide character is copied.

This is the wide character equivalent of strncat (<cstring>).

Parameters

destination
Pointer to the destination array, which should contain a C wide string, and be large enough to contain the concatenated resulting string, including the additional null wide character.
source
C wide string to be appended.
num
Maximum number of characters to be appended.
size_t is an unsigned integral type.

Return Value

destination is returned.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
/* wcsncat example */
#include <wchar.h>

int main ()
{
  wchar_t wcs1[20];
  wchar_t wcs2[20];
  wcscpy ( wcs1, L"To be " );
  wcscpy ( wcs2, L"or not to be" );
  wcsncat ( wcs1, wcs2, 6 );
  wprintf ( L"%ls\n", wcs1);
  return 0;
}


Output:

To be or not

See also