I am writing a program that takes input from the user via stdin. In
addition, the program could take input from a file if stdin has been
redirected. I detect this using `isatty'. If the program has been started
as:
% ./a.out < input_file
after reading lines from the input file (redirected stdin), how do I redirect
stdin to what it was before redirection? This way I can take more input from
the user and any child processes will behave the same independent of whether I
typed:
% ./a.out
or
% ./a.out < input_file
I suspect it has something to do with dup, dup2, freopen, etc... but the man
pages are not too clear on this.
Thanks,
--
_____________
#___/John E. Davis\_________________________________________________________
#
# internet: da...@amy.tch.harvard.edu
# bitnet: davis@ohstpy
# office: 617-735-6746
#