Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Search this Thread
Old 01-30-2009, 12:46 AM   #1
LQ Newbie
Registered: Jan 2009
Posts: 4

Rep: Reputation: 0
Smile how to get the name of process from PID in C/C++?

Can anyone help me to find out name of the process from process ID in C/C++ program?

Thanks in Advance
Old 01-30-2009, 04:25 AM   #2
Registered: Jun 2008
Location: Torino, Italy
Posts: 65

Rep: Reputation: 17
Take a look at /proc/<pid>/exe. It's a symlink to the binary that created the process.
Old 02-02-2009, 11:23 AM   #3
LQ Newbie
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Hi irey,

Thanks for reply..
Old 02-03-2009, 09:41 AM   #4
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,652

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Tell your teacher hello for me.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting pid of a process!! vishamr2000 Programming 34 03-12-2015 07:12 AM
How to get the PID of the process giving kill signal to a process? hariprd Programming 2 11-27-2008 03:10 AM
pid of a process kushkothari Programming 8 11-19-2008 05:06 AM
[C++] Get process ID (PID) Moraxus Programming 5 10-16-2008 12:31 PM
how to get more process' info according to its PID? iclinux Programming 1 02-05-2005 05:30 AM

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration