Mine's in /usr/bin too.
So best bet is to use system() with absolute path?
Printable View
Mine's in /usr/bin too.
So best bet is to use system() with absolute path?
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=