Example
The following example uses the wcscpy subroutine to copy a wide character string into a wide character array:
#include <string.h>
#include <locale.h>
#include <stdlib.h>
main()
{
wchar_t *pwcs1, *pwcs2;
size_t n;
(void)setlocale(LC_ALL, "");
/*
** Allocate the required wide character array.
*/
pwcs1 = (wchar_t *)malloc( (wcslen(pwcs2) +1)*sizeof(wchar_t));
wcscpy(pwcs1, pwcs2);
/*
** pwcs1 contains a copy of the wide character string in pwcs2
*/
}