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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.