3

Question to the C pros.
Is there an ANSI/ISO/POSIX function that searches for an executable in PATH and returns the absolute path,
Like "which" on the CLI.
I already searched for a while and couldn't find anything.

Comments
  • 0
    I don't think there is a single call that would do this for you, you're gonna have to write the search yourself.
  • 6
    No, there isn't. You'd even have to write a directory recursion yourself - not difficult though.

    However, why don't you just actually use "which" via a popen() call?
  • 1
    You're gonna have to do this yourself I believe. All the readily available executables are inside the folders in the $PATH environment variable. Open the folders yourself and search for the file.
Add Comment