Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!egrunix!schemers From: schemers@egrunix.UUCP (Roland Schemers) Newsgroups: comp.sys.amiga Subject: Re: Relying on ARP (was Re: My AmigaDOS 1.4 wishlist (one among thousands!)) Summary: popen! Keywords: popen, pclose, unix, arp Message-ID: <126@egrunix.UUCP> Date: 4 Aug 89 16:09:07 GMT References: <12878@well.UUCP> <26758@agate.BERKELEY.EDU> <20904@cup.portal.com> <26915@agate.BERKELEY.EDU> <11107@polya.Stanford.EDU> Reply-To: schemers@unix.secs.oakland.edu.UUCP (Roland Schemers) Followup-To: 32202 Distribution: na Organization: Oakland University, Rochester, MI Lines: 21 > I've always wanted to be able to fopen("|lpr", "w"), for instance, to > spool things automatically, or anything else with pipes. Why hasn't > any operating system (that I know of) allowed file names to also specify > new processes? I mean, I can open `par:' or `ser:' or even `speak:'. > Just a thought. Since no one else has posted an answer (I'm sure they will), I guess I'll do the honers. Unix has EXACTLY what you want. The system call is called popen! (Stands for Pipe? Process? open). Is has the following syntax: FILE *lpr_file; lpr_file = popen("lpr","w"); Then you can do all the normal file commands with it (fprint, etc...), and when you are do, just issue the pclose(lpr_file) call. I remember seeing a posting on swan.ulowell.edu, which has the popen call as written for the Amiga, although I do beleive you need Arp and a PIP: device to use it. roland (no cute sig) schemers