This is not a C ++ function, it is managed by the OS itself.
For example, Windows provides a call to the ReadProcessMemory () API so that you can get your dirty little hands into the memory of another process. And, of course, the equivalent for writing so you can do even more damage :-)
It all depends on having the right privileges.
I'm not sure how Linux provides this, but earlier UNIX files had memory mapping files, such as /dev/mem , so you could get in memory. In the procfs file system, there may be an option for each process that can give you access to the virtual memory of a specific process. This would be the first place I would begin to search, although others here would no doubt know more about it than I do.
source share