我已经为窗口定义了一个指针地址
#ifdef _WIN64
typedef uint64_t unit_pointer;
# define PRINTF_PTR "%I64x"
#else
typedef unsigned long unit_pointer;
# define PRINTF_PTR "%lx"
#endif
TEST *obj = &test_obj;
char obj_pointer_add[50];
sprintf(obj_pointer_add, PRINTF_PTR, (unit_pointer)obj);
现在我想在其他地方重新创建 obj 指针,因为我知道 obj_pointer_add。我如何将 obj_pointer_add 转换回 unit_pointer?
unit_pointer point_address= (unit_pointer)obj_pointer_add; (ERROR CONVERTING)
TEST *new_obj = reinterpret_cast<TEST *>(point_address); (fail because of pointer_address wrong)
谢谢