C, runtime test if executable exists in PATH
问题 I am currently writing an application in C, targetting BSD and Linux systems with a hope to being generall portable. This program a runtime dependency, in this case mplayer. As it stands I am using execlp() to start mplayer. I am checking the error code of the execlp call and I am testing for EACCESS , so I know when I attempt to run mplayer if it exists or not. Because of the way my program works, mplayer is a required dependency but may not be used for some time after my program starts. As