This question applies both to C and C++.
memcpy
basically copies raw memory from an address to another address.
So my question is: what's the point of wmemcpy
?
I mean, it's still contiguous space, and copying it is still the same process. It shouldn't matter if it's made of up wchar_t
's, or should it?
From MSDN documentation of wmemcpy
:
memcpy copies count bytes from src to dest; wmemcpy copies count wide characters (two bytes).
So the difference is on how many bytes will be copied with the given same arguments,when you say:
memcpy(src,dest,2);//2 bytes will be copied
wmemcpy(src,dest,2);//4 bytes,i.e 2*2 bytes will be copied
Other than this difference and possible convenience of use when using wmemcpy
when copying wchar_t
arrays, i don't think there is a difference between the two and the existence of wmemcpy
is really necessary.
Interfac will ensure you copied whole wchar_t number of symbols. You won't be able to copy odd number of bytes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With