I realize that trying to tamper with memory from another application or from the OS is considered bad programming.
However, I do not understand Objective C, and I need to read 25 bytes from a fixed memory address into a variable, and then replace those 25 bytes with a different set.
I'm terrible with pointers and with what all the * and the & and the @ symbols mean.
I am attempting this in Mac OS X 10.8 (Mountain Lion), using XCode 4.4.1.
I've tried things like:
char *myPtr = (char*) 0x7FFA8000 // just an example, not the real memory address
char myString[] = *myPtr
If it's 25 characters you might do it like this:
char *myPtr = (char*) 0x7FFA8000; // pointer to arbitrary memory address
char myString[26]; // buffer to copy data to
memcpy(myString, myPtr, 25); // do the copy
myString[25] = '\0'; // make sure string is terminated
To write back to the arbitrary address:
char *myPtr = (char*) 0x7FFA8000; // pointer to arbitrary memory address
char myString[26]; // buffer to copy data from
memcpy(myPtr, myString, 25); // do the copy
Note that in both cases you're just accessing memory within your own process's virtual address space - you're not reading/writing the memory of the OS or another process.