Click to See Complete Forum and Search --> : C question


hfawzy
06-20-2003, 04:48 AM
Hi,
How can I check if a given program exists on my computer using C ?

Thanks in advance.

tecknophreak
06-20-2003, 08:20 AM
Many ways,

1. If it's an actual program and in your path, you can use popen to look at the output of whereis programX.

2. If you don't know where it is and it's not in your path, you can use popen to look at the output of locate programX.

3. If you want to write your own whereis or locate, I suggest using opendir, readdir, etc. Check out the man pages for more info.