TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Rudy Oppers
from: Andrew Clegg
date: 1995-03-25 11:30:02
subject: linking output to input?

Hi, Rudy.

-=> Rudy Oppers spaketh unto All <=-

 RO> Does anyone know if it is possible to hook the input and output from
 RO> one program to the output and input from an other program?   Maybe
 RO> with a pipe or something like that? I am new to OS/2 programming
 RO> (MS-DOS and Amiga untill now :), so I don't know much about it...

You could probably do it with named pipes -- DosCreateNPipe and so on --
but I couldn't realy advise you on that as I don't know much about it.
However, if your compiler supports them, you could use Unix-style anonymous
pipes.

The popen() command starts a child process with its input connected to the
parent's output, *or* its ouput connected to the parent's input, but not
both. To use both directions, you need to use pipe() to create a 'double'
pipe with two handles, then you can use fork() and exec() to start a
process connected to the pipe. That's how I understand it anyway.

A couple of people have sent me some suggestions and code on this subject
over the past few days, see if you can find any of them.

One last thing; if you intend to use this with PM programs, you have to
remember that the stdin and stdout for a PM program isn't what is read from
the keyboard/displayed to the screen. stdin and stdout are by default
connected to null devices, but could be used for communication with other
programs, logging to a file, or whatever if redirected.

Andrew.

/* 2:440/4.10{at}fidonet.org 81:444/1.10{at}os2net.org 102:440/5.10{at}lifnet.org
   abc{at}warpfive.demon.co.uk   Stig{at}IRC   Andrew.Clegg{at}donor2.demon.co.uk */

--- LoraBBS-OS/2 v2.40b4 (Eval.)
* Origin: Ten Ground And Down, Guildford UK (2:440/4.10)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.