end of file characters and open file descriptors

Don E. Waagen waagen at cod.NOSC.MIL
Fri Dec 30 05:06:28 AEST 1988


   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.

I have tried flushing EOT characters (^D) to process B, but this doesn't help.
The fread call in process B remains blocked.  

I've also tried having process A's standard out dup'd and then closing standard
out, and then duping the duplicate back to 1 (standard out); no luck.  It 
seems the dup'd file descriptors share status fields.

My Question: What do the standard library calls use to determine end-of-file.
I really need to be able to do this, for a process to know when an end of 
transmission has occured.

Thanks in advance --
Don Waagen



More information about the Comp.unix.questions mailing list