s. keeling wrote:

Incoming from Michael Petch:


On Thu, 2004-10-07 at 10:23, Evan Brown wrote:


I need to get a processs ID for any program from within a program. Any C coders out there that can send me a code snippet or point me in the right direction.


unless I misunderstood the question, and this was linux - try:

getpid()



Unfortunately, that only gets the pid of the current process. Evan wants the pid of "... any program from within a program." I think the only solution is something like "system( "/bin/pidof program_name" );", and good luck if there's more than one instance of it running.

If it's a well behaving program, you might be able to rely on it
writing its PID to a lockfile, then you'd just have to parse/interpret
its lockfile filename/contents.




Thanx guys, I'll try that out. We're making a little piece of custom software and most of our time is spent in windows so we arn't as savy on Linux yet.

Evan


_______________________________________________ clug-talk mailing list [EMAIL PROTECTED] http://clug.ca/mailman/listinfo/clug-talk_clug.ca Mailing List Guidelines (http://clug.ca/ml_guidelines.php) **Please remove these lines when replying

Reply via email to