What's wrong with my memcpy statement?
Posted on 2004-04-01
I have a seemingly simple problem. I just want to copy 100 bytes from my buffer to an absolute memory address of an ARM processor. Let's say that address is 0x100000.
long int AbsAddr = 0x2000000;
char *chbuffer; // my buffer of 100 bytes
memcpy (AbsAddr, chBuffer, 100); // My statement
The C Compiler keeps complaining about incompatible cast. I understand AbsAddr is long int whereas *chbuffer is a char. But both of them are only pointers to char variables. Why pointers also need to have the same cast? I even test this statement and it still doesn't work:
char cTest = 0x01;
*AbsAddr = cTest; // Compiler also complains!