My C program running under Linux wants to find out, by name, if another program is running. How to do it?
There are two ways basically:
popen("pgrep yourproc", "r"); and then fgets from itopendir and readdir to parse /proc - this is basically what ps(1) doesNot the cleanest but I would go with the first of these.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With