|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
pointer
is it possible to use a pointer to see the data stored in a given
address in the memory ? if no what's the appropriate way to do that? thanks. |
|
#2
|
|||
|
|||
|
pointer
Thu, 03 Jul 2008 21:50:44 +0000, Richard Tobin wrote:
unsigned char *p = (unsigned char *)&a; int i; > for(i=0; i<sizeof(a); i++) printf("%02x ", p[i]); I think you need %02hhx there, or cast p[i] to (unsigned int). do you? unsigned char gets promoted to unsigned int right? So why do some implementations give an hh length modifier? why does the standard give the h modifier? viza |
|
#3
|
|||
|
|||
|
pointer
Pietro Cerutti <gahr_SPAM_gahr_ME_chwrote:
Richard Tobin wrote: If the number corresponds to some accessible memory, then it will work, but you need to be familiar with the details of your operating system. In a general purpose operating system with virtual memory, there's not likely to be anything much useful at fixed addresses. > Unless you /*are*/ the operating system. But if you are the S, you shouldn't be asking such fundamental questions as the P. Richard |
|
#4
|
|||
|
|||
|
pointer
4 Jul 2008 at 0:49, Jens Thoms Toerring wrote:
All you could dump is the mostky rather uninteresting address space of your program. the contrary, a core dump can be very interesting indeed when you're debugging a program. However, on most platforms this sort of memory dump is generated automatically when your program dies. If the P is interested in monitoring memory usage within a process, he might want to check out the source code to valgrind, though I think it's pretty hardcore stuff. |
![]() |
| Viewing: Web Development Archives > FAQs > C/C++ > pointer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|