سؤال

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.

هل كانت مفيدة؟

المحلول

You have to cast your pointer to the desired pointer type and then dereference, like so:

*(int*)(pointer)

This works in GDB, though I imagine it's similar in other debuggers.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top