Well, I have to revive a question that was answered here before. I've made some changes for other reasons and now I have a problem again. Here is the relevant details:
volatile char RxBuffer1[NEMA_BUFFER_LENGTH];
uint32_t NEMA_TypeStart;
char NEMA_Type[10];
uint32_t len;
...
memcpy(NEMA_Type,(const char*)RxBuffer1[NEMA_TypeStart], len);
With the cast I get the error shown in the subject line. Without the cast I get:
passing argument 2 of 'memcpy' makes pointer from integer without a cast
Note the same thing happens if I use strncpy instead. So I'm stumped. I thought I understood that memcpy uses void*. What am I doing wrong?
You need to pass addresses to memcpy
. I would assume you want:
memcpy(NEMA_Type,(const char*) &RxBuffer1[NEMA_TypeStart], len);