How to retrieving variable value in C++ if you know the variable address

前端 未结 5 1679
别那么骄傲
别那么骄傲 2021-01-23 05:50

Greetings,

I have recently started to code in C++ and have come across a problem to which I was unable to find the answer, so I thought maybe somebody e

5条回答
  •  囚心锁ツ
    2021-01-23 06:19

    C++ has no comment on this, one way or the other. It depends entirely on the platform on which your program is running. If you're using Windows, for example, you can use the ReadProcessMemory() function to read the memory of another process (assuming you have adequate permissions).

    Note that modern operating systems are designed to protect processes from interfering with each other. One of the ways they do this is by giving each process its own address space. Processes can't access memory outside this space without using special APIs.

提交回复
热议问题