Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ncohen

macrumors newbie
Original poster
Mar 31, 2009
8
0
Hi everybody,
I'm trying to read into a memory address in Objective-C... For example, I have the address 0x0078C900 and I want to store in a variable the 16 bits which start from this address! How can I do that? What kind of variable can I use?

If you also know how to convert a signed signed integer into a int...

Thanks!
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I didn't understand exactly what you meant... but I'll try to give you something that would do what i think you want:
Code:
/* we'll assume that myAdr is a void * that has the address 0x0078C900 stored in it */
short myShort = 0;
myShort = *(short *)myAdr;

myShort will now contain the 16 bits starting at the given address interpreted as a 16-bit integer value.

As for the "signed signed integer", there is no such type. int is already a signed integer.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.