0

What I'd like to do is have my C++ code open up Mplus (statistical program that I've downloaded on my computer) and run it. Is it possible?

Steve
  • 6,193
  • 2
  • 37
  • 66
Jacob Curtis
  • 738
  • 1
  • 7
  • 20
  • 2
    The answer to this is OS dependent. Which OSes are you targeting? – Magnus Hoff Apr 14 '14 at 17:00
  • Please look at [http://stackoverflow.com/questions/9550488/how-do-i-run-an-external-program][1]. It explains the same issue. [1]: http://stackoverflow.com/questions/9550488/how-do-i-run-an-external-program – ptrehan Apr 14 '14 at 17:04
  • 1
    It is always possible that if you try to describe what you are attempting to achieve, someone could recommend a better way of accomplishing your goal. – StephenH Apr 14 '14 at 17:07
  • is it worth it to make a program just for that ? why not just write a shell script ? – Moha the almighty camel Apr 14 '14 at 17:19

1 Answers1

2

You may be able to do what you want with std::system() calls like:

std::system("program -e input_commands.txt"); // Assuming it accepts some sort of command line args
std::system("program < input_commands.txt"); // Assuming it responds to stdin

It depends on the program if this approach will work.

metal
  • 5,867
  • 33
  • 46