wmemcpy - C wchar.h

C examples for wchar.h:wmemcpy

Type

function

From


<cwchar>
<wchar.h>

Description

Copy block of wide characters

Prototype

wchar_t* wmemcpy (wchar_t* destination, const wchar_t* source, size_t num);

Parameters

Parameter Description
destination Pointer to the destination array.
source Pointer to the source of data.
num Number of bytes to copy.

Return Value

destination is returned.

Demo Code


#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;
}

Related Tutorials