Execution
Is there a command in which for a line of code to open up another program outside of the code within the program?
I know this code is wrong but its showing what I mean...
1 2 3 4 5 6
|
#include <iostream.h>
int main ()
{
execute test.doc;
return 0;
}
|
something along those lines.
There's system():
1 2 3
|
int main(){
system("test.doc");
}
|
It works just like the command line. Note that your program will halt its execution at that point until that other program closes.
thanks..., can it execute another c++ program or does it go straight to the code?
If you want it to execute the program, use this:
|
system("yourProgramNameHere.exe");
|
If you want it to open up the source code in a text editor, use this:
|
system("notepad yourProgramNameHere.cpp"); //command may vary depending on your editor of choice.
|
See? Just like the command line.
thanks...great help
Topic archived. No new replies allowed.