LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

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


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

Thanks in Advance
Kulandaivelu.S
 
Old 01-30-2009, 04:25 AM   #2
irey
Member
 
Registered: Jun 2008
Location: Torino, Italy
Posts: 66

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
kulandaivelu
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
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

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


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:44 AM.

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