Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bria!mike Newsgroups: comp.unix.questions Subject: Re: Redirecting stdout, and then getting it back Message-ID: <441@bria> Date: 14 Feb 91 21:24:21 GMT References: <1991Feb14.035930.20173@berlioz.nsc.com> Reply-To: uunet!bria!mike Organization: MGI Group International, Los Angeles, CA Lines: 27 In an article, berlioz.nsc.com!nelson (Taed Nelson) writes: | |We have a "shell" program which executes programs from within it using the | system()/spawn() call. We wanted to trap these errors, so we freopen()ed | stdout and stderr to files that we could parse/show to the user from within | the "shell". This part works fine. | |We also want to provide a "subshell" capability to get out to csh or DOS, but | clearly we want stdout and stderr to go back to the screen. Unfortunately, | freopen() closed the original screen file, so we can't get output to go | there. How about using /dev/tty, such as: freopen("/dev/tty","r",stdin); freopen("/dev/tty","w",stdout); freopen("/dev/tty","w",stderr); |(Thanks!) You're welcome. -- Michael Stefanik | Opinions stated are not even my own. Systems Engineer, Briareus Corporation | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly found to be saying things like "Well, it works on my DOS machine ..."