floyd@starsend.UUCP (Floyd Miller) (03/28/90)
We have seen plenty answers as to why *a* file appears when using a pipe, including how the file is used instead of memory (as in UNIX) and that later versions of DOS place the file in the root directory of the current drive. However, the original question (and you can see this if you run the "dir \ | more" experiment) asked why there are two files created. I'm still waiting to see a response to that! If the implementation of a pipe in DOS is to create a temporary file, why are two files created? ******* ***************************************** ***** ************************* Floyd Miller *** *************** floyd@starsend.UUCP * ********* floyd%starsend@PRC.Unisys.com *** starsend!floyd@burdvax.PRC.Unisys.com *
Ralf.Brown@B.GP.CS.CMU.EDU (03/28/90)
In article <0023@starsend.UUCP>, floyd@starsend.UUCP (Floyd Miller) wrote: }If the implementation of a pipe in DOS is to }create a temporary file, why are two files created? Programmer laziness. You need two temporary files if you want to chain three or more programs with pipes. 4DOS only creates the files as needed (if you do DIR|MORE, you get one temporary file; DIR|SORT|MORE creates two, then deletes the no-longer-needed first before running MORE). -- UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask ARPA: ralf@cs.cmu.edu BIT: ralf%cs.cmu.edu@CMUCCVMA FIDO: Ralf Brown 1:129/46 "How to Prove It" by Dana Angluin Disclaimer? I claimed something? 16. proof by cosmology: The negation of the proposition is unimaginable or meaningless. Popular for proofs of the existence of God.
richard@calvin.spp.cornell.edu (Richard Brittain) (03/29/90)
In article <0023@starsend.UUCP> floyd@starsend.UUCP (Floyd Miller) writes: >We have seen plenty answers as to why *a* file appears >when using a pipe, including how the file is used instead >of memory (as in UNIX) and that later versions of DOS >place the file in the root directory of the current drive. >However, the original question (and you can see this if you >run the "dir \ | more" experiment) asked why there are two >files created. > >I'm still waiting to see a response to that! >If the implementation of a pipe in DOS is to >create a temporary file, why are two files created? Command.com seems to be lazy, and creates a pair of pipe files whenever a pipe is encountered. If you think about it, building a multi-stage pipeline using temporary files will require at most two files e.g. dir | sort | find "foo" | more Other shells, like 4dos, only create 1 pipe file if only one is needed. If a pipe dies unexpectedly, the pipe files may not be automatically deleted, so strangely named zero length files in the root directory can become permanent. Richard Brittain, School of Elect. Eng., Upson Hall Cornell University, Ithaca, NY 14853 ARPA: richard@calvin.spp.cornell.edu UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard