Filtering I/O -- both of them.
Christian Brunschen
d89cb at efd.lth.se
Sun Jul 8 22:07:42 AEST 1990
I'm working an a small program that will function as an i/o filter for
mail (1) -- fyi, so tat all occurrences of 'mail' can be replaced with
'femail' (No, not my idea -- I'm doing this for a friend :)
Anyway, i could use popen(), but that only lets me specify either
stdin or stdout replacement -- not both, the way I need it.
So I thought of :
* creating two pipes
* fork()ing
* in the child process, redirect stdin to one pipe & stdout to the other
* in the cild process, execve() mail(1)
* in the parent process, perform i/o and filtering
BUT (and here's my question) :
how do I actually redirect stdin / stdout to the pipes I created ?
I tried
stdin = fdopen (MyPipe [1], "r");
but that, naturally, didn't work (illegal lhs of assignment)
So, if anyone has any ideas, please tell me; All help will be greatly
appreciated!
aTdHvAaNnKcSe
-- Christian Brunschen
--
+--------------------------------+---------------------------------+
| Internet : d89cb at efd.lth.se | IRC : snooker |
+------------------------------------------------------------------+
| Apart from the unknowns, everything is obvious." |
| - ZORAC, board computer of the Shapieron, in |
| James P. Hogan's "Giants' Star" |
+------------------------------------------------------------------+
More information about the Comp.lang.c
mailing list