I'm writing a program that opens an application on giving the name of the application to the program as input. How do I make the program search for the application at run time and find out whether it is installed or not in a linux system? I am writing the program in c++.
1
If you assume that by installed programs you mean programs that are in PATH
directory, then do:
if (system("which programName") != 0)
//your program is not installed in PATH directory
PATH
environment variable. That's how a shell locates an executable when you type a command. – StoryTeller - Unslander Monica Jan 13 '14 at 12:14sudo apt-get
– Rugal Jan 13 '14 at 12:24