在 Visual C++ 中查看分配为 char 的内存位置上的整数2008调试器
我正在使用 Visual C++ 2008 来编写和调试我的项目。我有一个 char* 指针。我想在调试器中以整数形式查看从指针开始的 4 个字节。我该怎么做?我想到了 (int)(*pointer) 但恐怕它只会简单地获取指针指向的 1 字节值并将其转换为整数。
I'm using Visual C++ 2008 to write and debug my project. I have a char* pointer. I want to view 4 bytes starting at my pointer as an integer in the debugger. How do I do it? (int)(*pointer) comes to mind but I'm afraid it will simply take the 1-byte value pointed to by pointer and convert it to an integer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将指针转换为所需的指针类型,然后取消引用,如下所示:
这在 GDB 中有效,尽管我认为它在其他调试器中也类似。
You have to cast your pointer to the desired pointer type and then dereference, like so:
This works in GDB, though I imagine it's similar in other debuggers.