[vox-tech] file and keyboard input stream in C

Mike Simons vox-tech@lists.lugod.org
Tue, 04 Mar 2003 11:29:38 -0500


On Tue, Mar 04, 2003 at 11:20:11AM -0500, Mike Simons wrote:
>   there is only one stdin, fd 0.  when you run a program like:
> ./a.out < myfile.txt, that fd is attached to a open copy of the file.
> I don't think you can get at the "real" stdin.

On Tue, Mar 04, 2003 at 08:18:28AM -0800, Tim Riley wrote:
> open it again from the keyboard using /dev/tty.

Tim is correct.  Opening /dev/tty will reattach the "keyboard" to a
program that for whatever reason lost it's normal stdin.