What sort of function/statement do i use to start up a .exe from inside my code?
What sort of function/statement do i use to start up a .exe from inside my code?
Here is some code to mess with. There are other ways, like spawn, but this should give you an idea....Code:#include <stdlib.h> #include <iostream.h> #include <conio.h> int main(void) { int choice; cout<<"Press the number for the choice of program you want to run."<<endl <<endl<<endl; cout<<"1. Windows Calculator"<<endl <<"2. Windows Notepad"<<endl <<"3. Windows Paintbrush"<<endl <<"4. Windows Solitaire"<<endl <<"5. EXIT"<<endl; while(choice != 5){ choice = getch(); switch (choice) { case '1': { (void)system("C:\\WINDOWS\\CALC.EXE"); break; } case '2': { (void)system("C:\\WINDOWS\\NOTEPAD.EXE"); break; } case '3': { (void)system("C:\\WINDOWS\\PBRUSH.EXE"); break; } case '4': { (void)system("C:\\WINDOWS\\SOL.EXE"); break; } case '5': { exit(EXIT_SUCCESS); } } } return 0; }
C++ Is Powerful
I use C++
There fore I am Powerful