C <wchar.h> - wcscat() Function
The C <wchar.h> wcscat() function is used to append a copy of the wide character string pointed to by source to the end of wide character string pointed to by destination. The terminating null character in destination is overwritten by the first character of source, and the resulting wide string is null-terminated.
The behavior is undefined if the destination is not large enough for the content of resulting wide string (including the null character), or if the strings overlap.
Syntax
wchar_t* wcscat (wchar_t* destination, const wchar_t* source);
Parameters
destination |
Specify pointer to the null-terminated wide string to append to. |
source |
Specify pointer to the null-terminated wide string to copy from. |
Return Value
Returns destination.
Example:
The example below shows the usage of wcscat() function.
#include <stdio.h> #include <wchar.h> int main (){ wchar_t str[256] = L"Hello "; wcscat(str, L"World!."); printf("%ls\n", str); wchar_t str2[256] = L" Programming is fun."; wcscat(str, str2); printf("%ls\n", str);; return 0; }
The output of the above code will be:
Hello World!. Hello World!. Programming is fun.
❮ C <wchar.h> Library