View Full Version : Read into a memory address

Mar 31, 2009, 11:14 AM
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...


Mar 31, 2009, 11:35 AM
I didn't understand exactly what you meant... but I'll try to give you something that would do what i think you want:

/* 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.


Mar 31, 2009, 12:52 PM
That exactly what I was looking for!