Xref: utzoo comp.lang.c:26261 comp.sys.ibm.pc.programmer:108 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c,comp.sys.ibm.pc.programmer Subject: Re: Redirecting STDOUT using spawn Message-ID: Date: 23 Feb 90 23:43:59 GMT References: <14466.25E403FD@urchin.fidonet.org> Reply-To: peter@ficc.uu.net (Peter da Silva) Followup-To: comp.sys.ibm.pc.programmer Organization: Xenix Support, FICC Lines: 10 > freopen("FILE", "w", stdout); > ercode = spawnlp(P_WAIT, "PROG.EXE", "PROG", "ARGS", NULL); > freopen("CON", "w", stdout); Let me be the first of no doubt many people to point out that this does not redirect stdin back to normal. If the program you were running was already redirected, that redirection will be lost. To really do this right you need to use a lower-level routine. Observe followups... -- _--_|\ Peter da Silva. +1 713 274 5180. . / \ \_.--._/ Xenix Support -- it's not just a job, it's an adventure! v "Have you hugged your wolf today?" `-_-'