I'm writing a C++ program using the Boost libraries. I need to be able to find the full path of an executable, given only the name. This would be the equivalent of the Unix shell's which
utility, Windows' where
, or Python's shutil.which
.
Is there a way of doing this? I could of course write my own, by iterating over the PATH environment variable, but for portability I'd need to consider things like splitting on :
or ;
, etc, and if there's a pre-written (and tested!) routine for this I'd prefer to use it.