Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/161.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 从偏移量创建DWORD指针_C++_Memory_Pointers_Offset_Dword - Fatal编程技术网

C++ 从偏移量创建DWORD指针

C++ 从偏移量创建DWORD指针,c++,memory,pointers,offset,dword,C++,Memory,Pointers,Offset,Dword,因此,如果我想读取偏移量00A2E63C处的一些信息(例如。。。 我需要把它作为一个DWORD 如何将“00A2E63C”字符串转换为正确的DWORD 谢谢你的帮助 std::stringstream hai; // insert string into hai here DWORD d; hai >> d; void* ptr = (void*)d; // INVOKE HIDEOUSLY UNSAFE AND UNDEFINED BEHAVIOUR HERE 我不记得它是不是没

因此,如果我想读取偏移量00A2E63C处的一些信息(例如。。。 我需要把它作为一个DWORD

如何将“00A2E63C”字符串转换为正确的DWORD

谢谢你的帮助

std::stringstream hai;
// insert string into hai here
DWORD d;
hai >> d;
void* ptr = (void*)d;
// INVOKE HIDEOUSLY UNSAFE AND UNDEFINED BEHAVIOUR HERE
我不记得它是不是没有定义。但它几乎肯定是非常不安全的

unsigned long x = strtoul("00A2E63C", NULL, 16);

这会将字符串“00A2E63C”转换为无符号长。

您可能需要在其中的某个位置添加
std::hex