You can use the proc filesystem. Documented in the proc man page. Approximate workflow:
use getpid() to get process ID
read appropriate files under /proc/<process ID>
I even found a C++ example how to access /proc:
http://blog.davidecoppola.com/2016/1...line-in-linux/. And
another example getting some information from several processes.
To learn more about the proc filesystem, you may want to search for
procfs.
I remember the pstat(2) system call in UNIX, but it seems to me that Linux doesn't have it.