## Programming

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

### Programming

Hi people,
I was hoping someone would give me some direction in this matter.I am currently trying to figure out how to make a program i have written execute or communicate with other programs.
Thank You.
WhyNotNow
New User

Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)

### Re: Programming

WhyNotNow wrote:Hi people,
I was hoping someone would give me some direction in this matter.I am currently trying to figure out how to make a program i have written execute or communicate with other programs.
Thank You.

I'm not exactly sure what you're asking... Are you asking how to make programs communicate with other programs? Also, there's a sub-forum for programming: viewforum.php?f=36
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook

centip3de
Moderator

Posts: 1412
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)

### Re: Programming

Well thank you for your first link, but to clarify a bit more. I have written a program, now i would like that program to launch another upon opening or until specify command is issued. Just some direction would be of great help.
WhyNotNow
New User

Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)

### Re: Programming

WhyNotNow wrote:Well thank you for your first link, but to clarify a bit more. I have written a program, now i would like that program to launch another upon opening or until specify command is issued. Just some direction would be of great help.

Well, it depends on a few things; your OS, and the language. I'm assuming you're on Windows, in which case just make a batch file with:

Code: Select all
yourProgram.exe theOtherProgramYouWantToLaunch.exe

If you want to wait for a specific command, then that would depend highly on your language. Which is...?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook

centip3de
Moderator

Posts: 1412
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)

### Re: Programming

OK great. The language im using is C++ and yes it is windows. Thank You for your cont. help.
WhyNotNow
New User

Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)

### Re: Programming

system();

With your file path in brackets would work.

wan26
Experienced User

Posts: 91
Joined: Sun Jan 22, 2012 6:46 pm
Blog: View Blog (0)

### Re: Programming

WhyNotNow wrote:OK great. The language im using is C++ and yes it is windows. Thank You for your cont. help.

Then if you're waiting for a certain command, and not looking for anything fancy:

Code: Select all
#include <iostream>using namespace std;int main(){    string foo;    cin >> foo;    if(foo == "yourStringHur")    {        system("that\Other\App\You\Want\to\Launch.exe");    }return 0;}
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook

centip3de
Moderator

Posts: 1412
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)

### Re: Programming

Another alternative way is using ShellExecute(since your using windows, requires to include windows.h or Shellapi.h ):
Code: Select all
ShellExecute( NULL, "open", "ApplicationName.exe","Parameters", "Path/to/work/directory/", SW_SHOW);
ghost107
Poster

Posts: 132
Joined: Wed Jul 02, 2008 7:57 am
Blog: View Blog (0)