Hello all, I have a question regaarding the standard function in cstring.h called memcpy. My issue is that this function should be of the form:
void *memcpy(void *str1, const void *str2, size_t n);
When I try to call it in the form:
unsigned int dst;
unsigned int src;
memcpy(&dst, &src, 5);
it only copies 1 byte, because that is the length of "5". I want it to copy 5 bytes. I tried casting the constant 5 to type "size_t":
memcpy(&dst, &src, ((size_t)5));
This also didn't work.
The way it does work, (although not the way i intended) is:
memcpy(&dst, &src, sizeof(dst));
How do I use a integer constant or variable in the quantity of bytes field!?
PS: I am using a Coldfire MCF52259.