How can I get back to the interactive keyboard if stdin is redirected?
C Interview Questions and Answers
(Continued from previous question...)
How can I get back to the interactive keyboard if stdin is redirected?
Q: I'm trying to write a program like ``more.'' How can I get back to the interactive keyboard if stdin is redirected?
A:There is no portable way of doing this. Under Unix, you can open the special file /dev/tty. Under MS-DOS, you can try opening the ``file'' CON, or use routines or BIOS calls such as getch which may go to the keyboard whether or not input is redirected.
(Continued on next question...)
Other Interview Questions
|