C/C++
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs C/C++

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old July 3rd, 2008, 06:09 PM
Jrdman
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #2  
Old July 3rd, 2008, 09:30 PM
viza
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #3  
Old July 4th, 2008, 06:01 AM
Richard Bos
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #4  
Old July 4th, 2008, 01:00 PM
Antoninus Twink
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.


Reply With Quote
Reply

Viewing: Web Development Archives FAQs C/C++ > pointer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway