Hello. I've been looking at reading and writing to memory using C recently and would be grateful for your help. I've put together these two programs, but I know they're wrong.
Code:
char memstring[];
for(i=0; i<=4096; i++)
// go through the memory from 0x000 to 0xFFF
int*ptr=0xi;
// Pointed to memory location = I got this from Google
memstring[] = i;
// Assign the contents of each memory location to an entry in the array
Code:
char memstring; int location;
for(i=0; i<=4096; i++)
// Go through the memory locations from 0x000 to 0xFFF
int*ptr=0xi;
// Pointer to memory location - I got this off Google
if(i = location)
// When we reach the location identified in the location variable
memstring = i;
// Assign it's contents to the string variable
I don't know if I've got the memory location bits right, as well as accessing the memory in the first place. Also, as it's an int we're dealing with, FFF wouldn't work, so I thought I'd have to write it as 4096, but then I'm not sure how to convert it back into hex.
As said before, I really do appreciate your help. I tried searching on Google, this board and different groups, but there doesn't seem to be much info on this particular topic.
Thanks again in advance.
Hussein.