I am porting an application from Unix to Windows NT. The complete
application consists of one executable built with FORTRAN source code and
Unix shell scripts. I have already built a console application with the
FORTRAN source code and the Unix shell scripts have been converted to Perl
Problem : The original shell scripts is setting some environment variables,
which are looked for by the executable. One of the variables is set
to the value returned by a Unix utility 'tty'. This utility on Unix displays
the terminal name. The problem I am facing is that the Fortran
executable is opening with the filename specified as this terminal name. The
subsequent READ and WRITE statements using the Unit specifier,(
specified with the open statement while opening this terminal) are now
directed to this terminal. Since there is no such utility as 'tty' on
Windows, what I need to work out is same logic in which the open
statement should open a unit directed to CONSOLE. The following subsequent
READ and WRITE statements with the Unit specifier, as specified
in the open statement while opening file directed to
CONSOLE, should now read and write on the CONSOLE.
What I have tried : I have already tried the following.
Given open statements with File name specified as 'CON',
'USER', 'CONOUT$' and 'CONIN$'. While the
subsequent WRITE statements are successful for the first three and the READ
statements are failing, the READ statements are
successful for the last one and WRITE statements fail.
Please let me know how can I work out a solution for this. How can I achieve
the similar functionality for the application when ported to Windows NT.