Hi guys,

I have a Java console app which I need one of my asm progs to talk to. I had assumed it'd be a simple matter of running it frrm the prog with CreateProcess and simple redirecting the SidIn/Out.

Unfortunatly the examples I've found all assume that you've written the second app yourself and so can get it to redirect its own StdIn/Out to a pipe your main prog creates. The java app is one I've written actually, but I don't know how to go about redirecting in java, if its even possible.

Is there some way for my main app to manage all the redirecting itself without the java app evening knowing anythings happened?

Or perhaps someone could suggest another approach. The java app simply outputs some info to the console and waits for a number to be inputted, this just repeats over and over.

I also tried getting my app to output to the java console, while it was able to ouput a number, I couldn't manage to get it to register a return key press, if there is a way around that then I wouldn't need to worry about redirecting inputs/outputs.

Posted on 2003-12-04 04:19:48 by Eóin
Humm, how is the java program run? Compiled to exe? If replacing hStdInput, hStdOutput, hStdError in the STARTUPINFO struct with your pipe doesn't work, I don't really know what to do..
Posted on 2003-12-04 06:52:36 by f0dder
Try reading the iczelion pipe tut
Posted on 2003-12-04 07:58:48 by greenant
f0dder, I never even noticed those entries in the STARTUPINFO struct. The example I was working off never mentioned it and I forgot to check. Thanks, I'll try that tonight.
Posted on 2003-12-04 10:19:03 by Eóin
Note that you will have to fill the SECURITY_ATTRIBUTES when CreatePiping, and set the bInheritHandle to TRUE, and you will obviously also have to pass TRUE for the bInheritHandles argument to CreateProcess.

Good luck :)
Posted on 2003-12-04 11:41:21 by f0dder
That solved it, I've it working now. Thanks for the help.
Posted on 2003-12-05 14:15:13 by Eóin
Great, glad to have been of help :)
Posted on 2003-12-05 14:16:27 by f0dder