Programming

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

Programming

Post by WhyNotNow on Thu Mar 29, 2012 6:53 pm
([msg=65313]see Programming[/msg])

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
New User
 
Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)


Re: Programming

Post by centip3de on Thu Mar 29, 2012 7:18 pm
([msg=65314]see Re: Programming[/msg])

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
User avatar
centip3de
Moderator
Moderator
 
Posts: 1418
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Programming

Post by WhyNotNow on Thu Mar 29, 2012 9:12 pm
([msg=65316]see Re: Programming[/msg])

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
New User
 
Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)


Re: Programming

Post by centip3de on Thu Mar 29, 2012 9:43 pm
([msg=65319]see Re: Programming[/msg])

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


Would suit your needs.

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
User avatar
centip3de
Moderator
Moderator
 
Posts: 1418
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Programming

Post by WhyNotNow on Thu Mar 29, 2012 9:54 pm
([msg=65322]see Re: Programming[/msg])

OK great. The language im using is C++ and yes it is windows. Thank You for your cont. help.
WhyNotNow
New User
New User
 
Posts: 3
Joined: Thu Mar 29, 2012 6:48 pm
Blog: View Blog (0)


Re: Programming

Post by wan26 on Thu Mar 29, 2012 10:41 pm
([msg=65323]see Re: Programming[/msg])

system();

With your file path in brackets would work.
User avatar
wan26
Experienced User
Experienced User
 
Posts: 91
Joined: Sun Jan 22, 2012 6:46 pm
Blog: View Blog (0)


Re: Programming

Post by centip3de on Fri Mar 30, 2012 11:45 am
([msg=65336]see Re: Programming[/msg])

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
User avatar
centip3de
Moderator
Moderator
 
Posts: 1418
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Programming

Post by ghost107 on Fri Mar 30, 2012 12:55 pm
([msg=65337]see Re: Programming[/msg])

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
Poster
 
Posts: 132
Joined: Wed Jul 02, 2008 7:57 am
Blog: View Blog (0)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests