Getting value from memory address

I want to make a program to get the value saved at the particular memory address.
suppose i have opened two konsole windows.
In first window i have made a program in which i have declare a variable.
int a = 50;
i print its memory address.
cout << &a;
in another window i want to make a program so that i can get the value at the memory address as printed in the output of the first program.

I think
1
2
*P=&a;//the pointer holds the address of a
cout<<p;//p is the value at this address 

Is this what you were getting at or have i got the question wrong?
Reading the original question - it looks like the Original Poster, wants one program to read another program's address space directly.

If that is the case then the short answer is -- NO.
Last edited on
is not there any way to get this? guestgulkan, you understood my question correctly??
guestgulkan, you understood my question correctly??

Maybe I don't.
I read your question a couple of times, and based my answer on the fact that you seem to imply the use of two different programs.

To me this seemed that you have two different programs (or processes) and wanted one process to be able to access some data directly from the address space of the other process.
Topic archived. No new replies allowed.