end of file characters and open file descriptors

Leslie Mikesell les at chinet.chi.il.us
Sat Dec 31 01:52:04 AEST 1988


In article <1345 at cod.NOSC.MIL> waagen at cod.nosc.mil.UUCP (Don E. Waagen) writes:
>
>   I'm trying to have two processes communicate via a pipe (stdout), like 
>
>			A | B
>
>but with a small difference.  Process A will never die (i.e. the connection 
>will never be closed).  What I would like to do is have the fread and getchar()
>calls of process B sense or think that it is seeing the pipe close (i.e. an EOF
>character returned by the calls) without closing the connection.

If you have SysV style FIFO's (named pipes) the programs can actually do the
open/close.  In any case, though, you could send an agreed-upon character
or sequence as a terminator.  Or is the real problem the stdio buffering
keeping B from seeing anything until a block is filled and flushed?  If that
is the case, just use read() and write() instead of the buffered versions.

Les Mikesell



More information about the Comp.unix.questions mailing list