passing parameters from one executable program to another

I have to write two program on a dictionary and another the definition. the dictionary will pass a word to the definition program and the definition will define the work and pass it back to the dictionary program and print out the definition. The problem i am having is how do i pass parameters between to executable (exe) files.

i think you can let the programs communicate through text files (that has disadvantages: it is a bit slow for large files, and you must choose the file format carefully)

you can also achieve one-way comunication by having one executable call the other with command line arguments.

but it seems a better idea to put the necesary parts of each program in a library and make another program that uses of these libraries. That way you can pass the information you want through function calls.

Inter-process communication is an OS dependent operation. To do specifically what you are asking on a Windows platform you want to use something called "Pipes":

There are other options, but this one matches what you are describing.
thanks for the replay. can you give me an example on how to do this. "one executable call the other with command line arguments "
Is it ok that the solution you chose, although the easiest, would result in spaghetti/slop code to accomplish what you want? If yes then my next post would be your "example".
Thanks for replying. I just need an example showing me how to pass an word to the definition program and have it define and pass the definition back to the dictionary program. And your "example" will be fine with me. THANKS.
Last edited on
Yeah, I really need to stop posting when I drink. If I find time later today I'll throw an example together. I still suggest using pipes.
Topic archived. No new replies allowed.