I want to copy an uint8_t
array to a uint8_t
pointer
uint8_t temp_uint8_array[] = {0x15, 0x25, 0x32, 0x00, 0x52, 0xFD};
uint8_t* Buffer = temp_uint8_array;
And now :
Buffer = {0x15, 0x25, 0x32};
So I understand that my data is cut because of 0x00, is there a solution ?
As I have access to the size of tha datas to be copied I tried to use
memcpy(Buffer, &temp_uint8_array, local_length);
But it does not work
The memcpy isn’t correct :
memcpy(Buffer, &temp_uint8_array, …
As temp_uint8_array is an array then you should not prefix it with & :
memcpy(Buffer, temp_uint8_array,…
Buffer is pointing to temp_iint8_array so the memcpy does nothing but erasing bytes in the same memory location. You IDE might consider that uint8 array may be handled as char string and display contents until 0x00.