ao@cevax.berkeley.edu (A Ozselcuk) (04/12/88)
Hello,
The problem with highly interactive fortran programs is that,
you cannot redirect its output as, all the program
prompts go in the redirected file.
If you do all your interaction with the program through your tty
then, the program output can be securely redirected.
i.e. a command of the form
a.out > outfile
will put all the real output from the program (not the user prompts)
into outfile.
The following example shows how to interact with your program
through your tty. It does not matter which tty you log on
the Kernel takes care of finding the correct one.
Note that this approach is somewhat esoteric, and the same goal
can be accomplished by other methods. However I like mine :-)
program foo
integer i, range
open (1, file='/dev/tty', status='unknown')
C THESE ARE THE USER INTERACTION I DO NOT WANT TO REDIRECT
write (1,*) ' Enter the range'
read (1,*) range
C
C File 1 is supposed to emulate stderr
do 1 i = 1, range
write (1,*) ' This goes to stderr'
C These are the REAL output of the program
print *, 'This goes to stdout'
1 continue
stop
end
________________________________________________________________
Akin Ozselcuk Experientia Docet
ao@cevax.Berkeley.Edu
...ucbvax!cevax!ao