What is the point of having wmemcpy?

This question applies to both C and C ++.

memcpy basically copies raw memory from an address to another address. So my question is: what is the point of wmemcpy ?

I mean, this is still a continuous space, and copying is still the same process. It doesn’t matter if it is created with wchar_t , or should it?

+5
source share
2 answers

From the MSDN documentation of wmemcpy :

memcpy copies the number of bytes from src to dest; wmemcpy copies count wide characters (two bytes) .

So the difference is how many bytes will be copied with the same arguments when you say:

 memcpy(src,dest,2);//2 bytes will be copied wmemcpy(src,dest,2);//4 bytes,ie 2*2 bytes will be copied 

Apart from this difference and possible usability when using wmemcpy when copying wchar_t arrays, I do not think that there is a difference between the two and the existence of wmemcpy . >

+4
source

Interfac ensures that you copy the integer number of wchar_t characters. You cannot copy an odd number of bytes

+3
source

All Articles