C examples for wchar.h:wmemcpy
function
<cwchar> <wchar.h>
Copy block of wide characters
wchar_t* wmemcpy (wchar_t* destination, const wchar_t* source, size_t num);
Parameter | Description |
---|---|
destination | Pointer to the destination array. |
source | Pointer to the source of data. |
num | Number of bytes to copy. |
destination is returned.
#include <wchar.h> int main ()//w w w. j a v a 2s . co m { wchar_t wcs1[] = L"this is a test test test test"; wchar_t wcs2[40]; wchar_t wcs3[40]; wcsncpy ( wcs2, wcs1, 40 ); /* copies characters in wcs1, then fills with L'\0' */ wmemcpy ( wcs3, wcs1, 40 ); /* copies 40 characters */ wprintf (L"%ls\n%ls\n%ls\n",wcs1,wcs2,wcs3); return 0; }