Copying uint8 array to another

XiotSamuel
Posts: 52
Joined: Sun Aug 29, 2021 1:50 pm

Copying uint8 array to another

Postby XiotSamuel » Wed Oct 27, 2021 2:51 am

hi all, I have following array and need to copying to another array

Code: Select all

int group_num = esp_mesh_get_group_num();
uint8_t dest_addr[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
mesh_addr_t *group_list = MDF_MALLOC(sizeof(mesh_addr_t) * group_num);

strcpy(dest_addr, group_list[1].addr);
do i miss something when copying?

ESP_Sprite
Posts: 8926
Joined: Thu Nov 26, 2015 4:08 am

Re: Copying uint8 array to another

Postby ESP_Sprite » Thu Oct 28, 2021 12:55 am

Strcpy is for copying strings, and you're not copying strings here. Use memcpy() instead.

Who is online

Users browsing this forum: No registered users and 85 guests