954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Calling other programs which take and return variables

How can I make a program which will call a program and send some variables to the program and then this new program will run and then return a new set of values. In essence trying to use a program to do the same thing as a function.

For example a calculator using a series of programs.
ie.
Main program asks user to specify which operation to do (addition, subtraction, division, multiplication), then the user inputs 2 numbers.
At this point the program calls another PROGRAM (each program does one of the above 4 operations) and sends it the 2 numbers the user inputted.
This new program will then do the operation and return the new value to the main program. At which point the main program will ouput the result.

Nauro
Newbie Poster
5 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

I'm curious why you want to go to all of this extra effort when functions would do. But what the hell, look into pipes. Create a pipe for each program and read/write to it accordingly during run-time.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You