Copy from dynamic array to static array
Posted on 2013-05-25
I have two question:
- First question:
I have an array statically allocated:
uint8_t* pSrcArray = new uint8_t; // 100 < MAX_LENGTH
// copied contents :
memcpy (dstArray, pSrcArray,100);
Is it safe to copy contents like that ? is there any more elegant way of doing that?
I have String MyString that I have received ;
I need to use this method with an API that takes uint8_t* as a parameter:
myAPI( uint8_t* pArray);
Is it safe to cast the const char* to uint8_t ?
Is there a better way of doing things.