wcsncat Function

Concatenate a wide string with another.

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<wchar.h>

Prototype

wchar_t * wcsncat( wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);

Arguments

s1
the wide string to append to
s2
the wide string to append
n
the maximum number of wide characters to append

Return Value

A copy of s1.

Remarks

The function appends no more than n wide characters of the wide string pointed to by s2 to the location of the null wide character at the end of the wide string pointed to by s1, stopping if a null wide character is encountered. A null wide character is then appended to the end of s1, implying that up to n+1 wide characters could be appended.

Example

#include <wchar.h>

int main(void)
{
  wchar_t ws[40] = L"A long";

  wcsncat(ws, L" time ago...", 5);
  wprintf(L"the complete wide string is \"%ls\"\n", ws);
}

Example Output

the complete wide string is "A long time"