Mine's in /usr/bin too.
So best bet is to use system() with absolute path?
Mine's in /usr/bin too.
So best bet is to use system() with absolute path?
Ubuntu Desktop
GCC/G++
Geany (for quick projects)
Anjuta (for larger things)
That's probably what I would do -- it's unlikely that anyone would be able to overwrite /usr/bin/gconftool-2. If they can, you have more serious problems.
But if you do hard-code the path, you might run into this sort of problem: http://linux.derkeiler.com/Newsgroup...5-05/1129.html
You know what I would do? If it's just a program that you're planning on running on your computer, hard-code the path. If you want to distribute it, or feel like a challenge, use execl() with a list of paths like /usr/bin, /opt/gnome/bin/ and so on . . .
Or execute another command like whereis to find all instances of that program in the path, and pick one that starts with /bin or /opt. Or check the directory where the program is located to see if it's owned by root, or at least if it's writable by anyone or not.
Or maybe I'm overcomplicating things. Yeah, you should probably just hard-code the path.
Also see: http://www.google.ca/search?hl=en&q=...e+Search&meta=
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.