Browsing index pages (3 articles)
↧
Getting the full path of a running PID with C/C++ without using the system...
So I want to be able to get the full path of a running process (which I have the process ID for) without using any commands on the command line. Anyone has any ideas on how to do this?I do have the...
View ArticleAnswer by nneonneo for Getting the full path of a running PID with C/C++...
Use readlink("/proc/<pid>/exe", buf, bufsize) to get the path to <pid>'s executable. This works on Linux, provided procfs is available (it usually is).Example usage:int...
View ArticleAnswer by Koshinae for Getting the full path of a running PID with C/C++...
man 3 realpathThis expands all symlink and directory relative token. Sadly, it is GNU specific, I use it with -std=gnu99, like printf("%s\n", realpath("/proc/self/exe", NULL)).
View Article
Browsing index pages (3 articles)