How to open .exe or .cpp programs from a main .cpp program?

Alright, so I know many people have asked this before. I am trying to make a program that will open other programs when the user enters a certain number. I have used the system() object and the ShellExecute neither have worked for me, it has giving me errors saying that windows cannot find the file, and I typed in the specific location for each program that will need to be opened. All I want to know is how you would do so, either a .pp file or .exe
Last edited on
> given me errors saying that windows cannot find the file

Verify that the correct path was specified.

Does this work for you?
1
2
3
4
5
6
7
#include <cstdlib>

int main()
{
    // specify the full path to notepad.exe; modify if the path if it is different on your machine
    std::system( "C:\\windows\\notepad.exe" ) ; 
}
it might work better for executables to use "start path\\programname.exe"
which is just a batch program trick that might be cool for you.

Topic archived. No new replies allowed.