Running shell script within a C or C++ program
Hi, I have a shell script that I'd like to execute from within a C++ program. For example, I need to access the man command, the redirection operator, and a command that converts a ps file to a pdf. If I can run my bash script from within a C++ binary this would take care of it. So would running each command from within the C++ program. I could also probably do this in C, but I'm not as familiar with C as I am with C++.
Make sure you've included cstdlib.
then do this:
if your batch file is in the path you can do
system(const char*); basically runs an executable.
Thanks, that worked great!
|All times are GMT -5. The time now is 10:50 AM.|