Running a shellscript from a C++ application and check if it succeeds
- by Koning Baard
I am creating an interpreter for my extension to HQ9+, which has the following extra command called V:
V: Interpretes the code as Lua, Brainfuck, INTERCAL, Ruby, ShellScript, Perl, Python, PHP in that order, and if even one error has occoured, run the HQ9+-ABC code again
most of them have libraries, BF and INTERCAL can be interpreted without a library, but the problem lies in ShellScript. How can I run a shellscript from my C++ application ( =the HQ9+-ABC interpreter) and when it's done, get the error code (0 = succeded, all others = failed)? So something like this:
system(".tempshellscript738319939474");
if(errcode != 0) { (rerun code); }
can anyone help me? Thanks