I'm interested in writing a program in C++ to automate the instructions necessary to run a certain python script I've been experimenting with. I was hoping someone could tell me where to look to find information on sending instructions to the command line from a C++ application, as I don't know what to google to find info on that.
Asked
Active
Viewed 725 times
0
-
What do you mean by "instruction"? – smeso Jan 02 '14 at 13:55
-
Have you considered using a [batch file](http://en.wikipedia.org/wiki/Batch_file)? I find them useful for executing commands with hard to type arguments. – Kevin Jan 02 '14 at 13:57
-
@Kevin writing a script to run a script seems rather perverse... but then again, so does writing a C++ program to run a Python script. – JBentley Jan 02 '14 at 14:06
-
The better solution would be to [embed Python](http://docs.python.org/2/extending/embedding.html) and skip the command line stuff. – MSalters Jan 02 '14 at 14:24
1 Answers
3
Hate to be the one to post it, but a nasty solution is the system
function - dare I speak its name. Call it with code that you want executed in the command prompt and it will run. If you want to start task manager like this, call it like this:
system("C:\\Windows\\System32\\taskmgr.exe");
Fair warning that nobody really likes to see system
in live code.

Proxy
- 1,824
- 1
- 16
- 27