#include #include #include #include #include #include using namespace std; #define T1_ADDRESS "28ffbb19841704c3" #define T2_ADDRESS "28ff112ca01705d0" #define T3_ADDRESS "28ffde61a01705e0" #define T4_ADDRESS "28ff3c09a017046b" #define T5_ADDRESS "28ff4459a01704e0" #define T6_ADDRESS "28ffbb19841704c3" #define T7_ADDRESS "28ff3e69a0170478" #define T8_ADDRESS "28ffcb4ba0170525" typedef unsigned char uint8_t; typedef uint8_t DeviceAddress[8]; int main() { char str_address[20]; char* p_str = str_address; DeviceAddress out; uint8_t* p_out = out; char buff[3]; strcpy(str_address, T2_ADDRESS); memset(buff, 0, sizeof(buff)); for (int i = 0; i < 8; i++) { buff[0] = *p_str++; buff[1] = *p_str++; *p_out++ = (uint8_t)strtol(buff, NULL, 16); } printf("%s\n", str_address); for(int i = 0; i < sizeof(out); i++) { printf("%X ", out[i]); } printf("\n"); }