Who should close the file descriptor?

Zack C. Sessions session at uncw.UUCP
Wed Feb 27 05:22:58 AEST 1991


dxl2585 at cs.rit.edu (Derek X Lee-Wo) writes:

>In article <27C4E07F.6689 at maccs.dcss.mcmaster.ca> ce3wa3bh at maccs.dcss.mcmaster.ca (Eric Ho) writes:
>>In my progam, two process are spawned, what this two processes doing is
>>the parent process write a message to the pipe, and the child process
>>read the message from the pipe.  After the parent process finished writting,
>>should I close the pipe write end file descriptor immediately, or leave this
>>to the child.

>When the child process is spawned, it inherits an identical set of file
>descriptors as the parent. 

This actually is machine/compiler dependent. While true in UNIX, it
is not necessarily true with all implementations of C. Not being
familiar with ANSI C, maybe this is in ANSI C?

Zack Sessions
...!ecsvax!uncw!session



More information about the Comp.lang.c mailing list