I am designing an C++ app that, among other things, executes a few scripts every now and then. The app should be efficient and preferably platform independent.
The issue is, however: is there a reason one shouldn't use system()
call for launching scripts and use, for example, POSIX facilities instead? The discussion on the matter that I've seen so far usually boils down to:
system()
is less flexible. (Fine with me)
- It offers no control of the command being executed. (Fine with me, I just need a return value from the script)
- It is not quite platform independent. (Now, this would be a concern. I would really love to see an example where it behaves differently on different platforms)
- It is a security concern. (Again, this would be an issue. Can someone provide an example of a potential security problem with
system()
? )
- Any other issues?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…