Need help - Want to send and receive data from external prog

Just starting out? Need help? Post your questions and find answers here.
Mark1Up
User
User
Posts: 19
Joined: Thu Jun 19, 2003 9:29 pm

Need help - Want to send and receive data from external prog

Post by Mark1Up »

Hello,

I'm trying to figure out how I can start an external program (for example RunProgram("cmd.exe") ) and then use stdin and stdout to pass data between the external program and my PB program. (I'm actually trying to use PB to interactively control an SSH terminal session using PuTTY (or Plink) as the external program.)

I have found PB examples that seem pretty straight forward using stdin/stdout when communicating to a PB console but not to an external program. Is there a different way I can start the external program (i.e. with WinAPI) that would allow me to use the stdin/out or is there a way to redirect the stdin/out to communicate with the external program started with RunProgram()?

Thanks in advance for any help on this. (Even some general pointers to best approach would be appreciated) :wink:

Best Regards,
Mark
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

El_Choni
Mark1Up
User
User
Posts: 19
Joined: Thu Jun 19, 2003 9:29 pm

Post by Mark1Up »

El_Choni,

Thanks for the quick reply but it looks like the MailSlot feature requires that I add mailslot handling to both the client and server application. In this case I am only programming in PB on one end of the communication, the other application is from a 3rd party and I don't have any control of handling mailslot communications. Is mailslot a standard feature that most applications support by default?

Regards,
Mark
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

If the external program is a console program, you can use pipes:

viewtopic.php?t=6544

If it's a GUI program, it depends on the interface, it would be more tricky.
El_Choni
Mark1Up
User
User
Posts: 19
Joined: Thu Jun 19, 2003 9:29 pm

Post by Mark1Up »

The pipes method looks like it might work. Boy, Microsoft sure doesn't make it easy to accomplish something that wouldn't seem to be that difficult.

Thanks again for the quick feedback!
Post Reply