Look at exec and system, these
are probably the functions you would use, they both have
ways of letting you know a file was not there to be executed,
or at least, that the command failed...
if they are always going to give you full path to a command
you can use -f filename and -x filename to make sure it is
a file and that the user can execute it...