Topic: Console screen, more
I tried reserving units 5 & 6 and now the console screen works ok.
Thanks
For discussions of all Approximatrix products and related software
You are not logged in. Please login or register.
Approximatrix Forums → User Support → Console screen, more
I tried reserving units 5 & 6 and now the console screen works ok.
Thanks
Hello, I find this a rather strange message.
What about reserving units 5 and (screen and printer) ?
Can you give a word more about it?
Units 5 and 6 in Simply Fortran's compiler refer to standard input and standard output by default. This assignment is pretty common in other Fortran compilers as well. When you use an OPEN statement and refer to either unit, your program will no longer be able to read from standard input (the keyboard) and/or write to standard output (the screen). Our compiler now warns during compilation if an OPEN statement attempts to use either unit.
Unit numbers under 20 have historically had special meanings depending on the compiler, platform, etc. It is best to either allow Fortran to manage unit numbers using the newunit specifier:
OPEN(newunit=unum, file="output.txt", status="unknown", action="write")
or use unit numbers that are over 100. Single digit unit numbers can be problematic depending on your compiler and/or platform. With our compiler, units 5 and 6 can be highly problematic to reassign.
Jeff,
I'm also confused about the Fortran 2008 "Newunit" identifier.
When not using "Newunit", an external unit identifier refers to an external file that is represented by an integer expression. The integer expression has one of the following values in the range 1 through 2147483647
When using "Newunit", Fortran 2008 standard requires that the unit number that comes back with the NEWUNIT specifier be a negative number.
INTEL Documentation says that NEWUNIT = u-var
Is a scalar integer variable that is assigned the automatically chosen unit number. It is always a negative integer.
IBM Documentation says that NEWUNIT= var (Fortran 2008) is an input/output specifier that specifies the NEWUNIT value for the connection. var is a scalar default integer variable. The NEWUNIT value is a negative number that is less than -2 and is unequal to the unit number of any currently connected file.
I've also read that it is less than -1. But my question is, can these negative unit numbers be easily turned into positive numbers for use in Input/Output?
Or should we use,
iunit = 0
do i = 100, 999
inquire ( unit = i, opened = lopen, iostat = ios )
if ( ios == 0 ) then
if ( .not. lopen ) then
iunit = i
return
end if
end if
end do
Frank
Approximatrix Forums → User Support → Console screen, more
Powered by PunBB, supported by Informer Technologies, Inc.