View Full Version : Writing to specific memory addresses in C/C++

Orleans Martinez
19th November 2004, 05:37 PM
I've been googling around for an answer and they never work!.. I am trying to write data to a specific memory address. It looks rather trivial as it should be only a few lines of code, but its being argghh. I've got this so far:

// hard code address
unsigned int m_loc = 0xAAA8EC00;

// set the pointer
char *loc = (char *) m_loc;

// write data to the location
*loc = 255;

This just gives me a run-time error however. I alos tried using the pokeb function in the dos.h library (which also didn't work). How is it done? Thanks in advance.

I would like a solution which doesn't point to learning windows API programming .