| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Need Help for unnamed pipe |
Hi Thomas,
TZ> I have to start a process with DosStartSesstion. This process
TZ> communicates with the child process via an unnamed pipe. The pipe is
TZ> used to redirect the stdin and stdout of the child process. Does
TZ> anybody has a codefragment witch manage such a redirection.
Unnamed pipes can transfer information between related processes only!
You may have to use DosExecPgm instead, but this wont work for
different types of programs (PM, Text mode, ...).
The following code fragment is derived from the sources of Eberhard
Mattes PM EMACS (pmterm.c):
int inbound[2], outbound[2];
if (pipe(inbound) < 0)
crtError("Cannot open pipe for Server.");
dup2(inbound[1], STDOUT_FILENO); /* Replace stdout with pipe */
close(inbound[1]);
fcntl(inbound[0], F_SETFD, 1);
if (pipe(outbound) < 0)
crtError("Cannot open pipe for Server.");
dup2(outbound[0], STDIN_FILENO); /* Replace stdin with pipe */
close(outbound[0]);
fcntl(outbound[1], F_SETFD, 1);
inbound[0] is used to read from, outbound[1] to write to the program.
If you prefer the API calls, replace pipe, dup2, close with
DosCreatePipe, DosDupHandle, DosClose (requires some modification).
... If at first you don't succeed, destroy all evidence that you tried.
--- Blue Wave/Max v2.12 OS/2 [NR]
* Origin: CCWN: Leistung ueberzeugt !!! (2:246/1401)SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430 SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 @PATH: 246/20 240/5500 396/1 3615/50 229/2 12/2442 711/409 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™.