ZedTuX
ZedTuX

Reputation: 3027

C++ Linux: Process PID from its path

I'm searching a way to get the current PID of a process having its path.

For example I know that the path firefox is /usr/bin/firefox, I have launched it and I would like to find its PID in C++.

How could I do that ?

Upvotes: 0

Views: 819

Answers (1)

BraveNewCurrency
BraveNewCurrency

Reputation: 13065

Take a look at the 'pgrep' program. Source is here, I think: http://procps.sourceforge.net/

Upvotes: 1

Related Questions