Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!mcnc!ecsgate!ecsvax!uncw!session From: session@uncw.UUCP (Zack C. Sessions) Newsgroups: comp.lang.c Subject: Re: Who should close the file descriptor? Message-ID: <1020@uncw.UUCP> Date: 26 Feb 91 18:22:58 GMT References: <27C4E07F.6689@maccs.dcss.mcmaster.ca> <2171@cs.rit.edu> Organization: Univ. of North Carolina at Wilmington Lines: 18 dxl2585@cs.rit.edu (Derek X Lee-Wo) writes: >In article <27C4E07F.6689@maccs.dcss.mcmaster.ca> ce3wa3bh@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