Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

Process Name from PID

My C++ program needs to determine the name of a running process from its pid, without parsing the output from ps.  How is this done?
0
tmetzger
Asked:
tmetzger
1 Solution
 
mtrCommented:
You didn't say what platform... some are different.  On some
(like AIX) you can use the getproc system call, which returns
a struct procinfo.  The progname is in the ui_comm field.
One of the GNU packages has a ps program in it -- you could
grab that and use it -- it probably has an example for whatever
platform you are on.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now