IPC
hi. i'm new to java and i want to make my program interact with a C++ program and i'm having trouble with inter-process communication.
when i call Runtime.exec( C++ prog ) i get the Std input and output streams and use them to construct an InputStreamReader and OutputStreamWriter.
i can capture the output from the C++ prog, but when i send stuff TO it from the java program, it evidently doesnt do anything. should i be using something other than an OutputStreamWriter? there are so many different input and output objects, it's hard for me to know when to use which. or is there some more general flaw in my approach?
should i be using sockets? i didn't have any luck trying to find out about pipes in java...
[750 byte] By [
spoongirl] at [2007-9-26 1:34:33]

thanx- that was helpful
one difference though between that and what i'm trying to do is that i'm actually running the c++ program from the java program, as opposed to vice-versa.
i've made some progress, but i'm still having the problem that i can't seem to write to the stdin of the C++ prog. i get output from the program, but not the other way around. based on my experimentation, i think there's nothing wrong with the C++ code and it is in fact reading the input stream and finding nothing there.
i think perhaps i'm misusing the OutputStreamWriter. is there another Writer object that i should use, instead?
thanx-
i did figure it out;
actually, the way i was trying to do the actual input and output was fine; it was just that i was doing the threading wrong, which was causing it to hang on the thread doing the input before it actually got a chance to do the output! (silly of me)
i just didn't have a clear understanding of how to use threads and i was directly calling the run() function instead of start()