Here's my problem. I have some existing programs, but I want to replace a single function call in Program A, with a completely separate Program B. I can't just implement program B as a sub-routine, even though I wish I could.
So my question is how would I go about calling a program from within another program. I did some searching and found popen() and CreateProcess(), but I believe those are good only on Windows. I'm using both an intel mac (w/ leopard) and linux. A cross-platform solution would be ideal, although I know this is unlikely. Both program A and program B are command line programs.
EDIT: Did some more searching, it seems like the commands I will use will probably be somewhere along the lines of System, exec, or Fork, and maybe still pOpen(). I'm still not really sure how to handle passing data between the two programs, since I will have quite a good amount of arrays and such that will need to be passed both directions. Any help is appreciated.