Thread View: alt.msdos.programmer
1 messages
1 total messages
Started by Fred Smith
Tue, 12 Dec 1989 14:11
I/O redirection in DOS
Author: Fred Smith
Date: Tue, 12 Dec 1989 14:11
Date: Tue, 12 Dec 1989 14:11
30 lines
1225 bytes
1225 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads