Carson <ca****@ieee.org> scribbled the following:
Hi,
How to write c code such that it supports pipe in?
i.e.,
echo "ABCD" | a.out
(how to write a c-code which generates the binaries a.out that can take the
pipe in input for further processing?)
Technically, pipes are an operating system feature and thus off-topic on
comp.lang.c.
However...
<OT>On most operating systems, for example all sensible Unices, these
kinds of pipes as you mention above are handled at stdio stream level.
This means that the first command's stdout is automatically connected to
the second program's stdin, and so on.
This means that you don't have to do *ANYTHING* to make your program
support pipe in. Just write your program using stdio streams like any C
textbook says, and the OS will automatically handle pipe in for you.
</OT>
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\--
http://www.helsinki.fi/~palaste --------------------- rules! --------/