-
Pointer to memory
I have an area of ram that holds data i.e. from 0x80000000 to 0x90000000. I am trying to point to the address 0x80000000 and access the data stored there and the subsequent addresses. A register holds the start address of this area of memory.
I tried the following but cannot access tha data stored at the address 0x80000000.
unsigned int Reg;
unsigned int *pAddr;
unsigned int Var;
Reg = 0x80000000;
pAddr = (unsigned int*)Reg;
Var = *pAddr;
Any ideas?
-
I'll assume you are using an imbedded system or something to that effect here since as Salem said normally you can't just grab an address like that.
You should be fine doing this:
Code:
unsigned int *pAddr = (unsigned int *)0x80000000 ;
Also, assuming you do have access to this memory address I'd advise that you be careful. Usually a person asking this question is one who really shouldn't be trying to do this (you would already know what to do). It is possible that this an address contains information that is crucial to your OS. Furthermore, you can really screw up things if by tinkering with system information. It usually would require a reboot, but I've heard of cases where the OS has been corrupted.