How can I open other programs in a main program?

I've created a code that sets a password, which is stored in a text file (encrypted), and is decrypted for guessing when the program is re-ran. At the end of the program I have created a "user interface" prompt, which I have been trying to give it the ability to open up C++ files (and eventually others). I've been trying to use system("START"), but there's been no luck.

My attempt (example):
system("START /B C:\\Users\\...(blah blah blah)...\\filename.cpp\"");

I got this idea for system start from http://ss64.com/nt/start.html which is a small informative index of the Windows CMD command line.

Im thinking maybe I should just skip the .cpp and try the .exe? But... then again, I have no experience with this...

Please help. Thanks
what do you mean open up c++ files? like as in run them?

and 2, you can't use /B because you can't open a *.cpp file in the command line.

now, if your goal was to run it, then what you want to do is to run the *.exe generated by the compiler.
First, describe the results that you are getting. Does your program run? Does it crash? Does it simple do nothing?

Second, the START command will only "open" a non executable file if the file extention has been associated with a program. Does the COMMAND string you are using in the call to system, work in an actual command console?

Third, I notice that the example file name that you have provided ends with a backslash, which indicates a directory named filename.cpp. If such a directory did exists, START would normally execute Explorer.exe to display it. If such a directory does not exist, you'll get a message box complaining about it.

Last edited on
1. The path is not correctly put in into the start command
2. use ShellExecute for Windows.
3. The last character is NOT a backslash. It's " \" " which is a simple " . But the first ", before C:\\..., is absent. Like you wrote: C:\\Windows" , instead you should write "C:\\Windows".
Good eyes, EssGeEich. I should have noticed that extra quote character.
Last edited on
Topic archived. No new replies allowed.