Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INQUIRE with UNIT=0

Status
Not open for further replies.

CJason

Programmer
Oct 13, 2004
223
US
I'm running Fortran on Linux, using the Intel compiler (11.x). My INQUIRE statements are telling me that UNIT=0 is OPENED. When I look at the filename, it tells me "/dev/pts/1". This is code that I've ported from VMS to Linux. Does VMS and Linux fortran differ in that UNIT 0 is now the terminal on Linux? If not, is there someway to get the fortran to again think that 0 is not valid?
 
/dev/pts/1 is a pseudo terminal, used for things like telnet. It is used to fool the OS into thinking there is something on the other side. What are you trying to do? If it is just output to the console, try units 5 and 6.
 
I'm simply trying to do an INQUIRE to see if a certain UNIT number is OPENED. However, when the UNIT is 0, it returns that it is OPENED. This is different than the behavior on VMS...UNIT 0 is not a valid UNIT number. Does anyone know how to make Linux treat 0 as not valid....or maybe some other idea how to deal with this? I'm probably just going to end up wrapping these INQUIREs in an IF check on the UNIT number being greater than 0 first.
 
In IVF7, 0, 5 and 6 are preconnected. Presumably IVF11 will be the same. This is from page 8-5 (200) of the Programmer's Reference Manual.
Unit numbers 5, 6, and 0 are preconnected; that is, they do not have to be
explicitly opened and are connected to system-defined files, as follows:
• Unit 5 is connected to standard input—by default, the keyboard of the
machine on which the program is running.
• Unit 6 is connected to standard output—by default, the
terminal/display of the machine on which the program is running.
• Unit 0 is connected to standard error—by default, the terminal/display
of the machine on which the program is running.
As you said, the easiest way is to replace all the INQUIRE statements with a function and check for units 0, 5 or 6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top