fredex@cg-atla.UUCP (Fred Smith) (12/12/89)
Yesterday I posted a plea for help with an I/O redirection problem. Well, last night I figured out what was the correct way to do it, so if any of you were planning to reply, I thank you, but it is not necessary now! Anyhow, for posterity's sake, what I needed to do was temporarily DISABLE existing redirection of stdin when spawning a child process, and then reenable the redirection after the child process exited. Here is a sketch of what I ended up doing, which seems to be just fine: int old; FILE *new; old = dup (fileno (stdin)); new = fopen ("CON", "r"); dup2 (fileno(new), fileno (stdin)); /* stuff here to do the child shell */ dup2(old, fileno(stdin)); fclose (new); (Of course, I can't claim all the credit--I had a bit of help from Ray Duncan's book Adavnced MSDOS!!!!!!!!) Fred Smith