Assigning a value to an address
I would like to write a function in C/C++ to copy the letter 'A' to a specific address.
This is what I have:
Now that (obviousely) is wrong, but I hope you can understand what I'm asking. There's probably a really simple way to do this, and if there is could you please tell me?
int * PAddr = NULL;
&PAddr = 0xb8f9e;
PAddr = 'a';
Hmmm... Will your OS allow this?
If you're using WinXP, WinNt, or Win2K, I you'll probably get a run-time error 'cause these operating systems don't allow user-mode programs direct access to memory. I think Win98 will work, but the virtual-paged memory might cause trouble. I also think Linux has similar user-mode protection.