I am looking for a way to execute a Linux executable from a separate Linux Executable that was compiled from C or C++. However, I have looked at numerous Stack Overflow posts which all direct the user asking to use the system()
function or a wrapper of the system function and I do not want a program that relies on the shell, because it could easily fall apart if it was transferred to a different operating system with a different shell.
In the post How do I execute an external program within C in Linux with arguments, the second answer states that execve()
is a wrapper for the system()
function, and this makes me wary of the other functions in the exec()
family.
I have also looked at the following articles:
- How do you write a C program to execute another program?
- http://www.cplusplus.com/forum/beginner/168287/
- Run Another Program in Linux from a C++ Program
All help is appreciated!