Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29487 Discussions

fortran error 38 during write to unit 6

jparry68
Beginner
1,004 Views
I am getting this error from a simple line
write(screen, *) where screen is defined as 6

This is a large legacy app thathas been ported fromCVF 6.6c. I am using IVF 11.1.046 and VS 2008SP1.

The fortran projects do use the following assumptions /assume:noold_unit_star /assume:old_logical_ldio which I think were obtained from another thread on redirecting 0,6 to the same console.

Thanks in advance.
0 Kudos
2 Replies
jparry68
Beginner
1,004 Views
Quoting - jparry68
I am getting this error from a simple line
write(screen, *) where screen is defined as 6

This is a large legacy app thathas been ported fromCVF 6.6c. I am using IVF 11.1.046 and VS 2008SP1.

The fortran projects do use the following assumptions /assume:noold_unit_star /assume:old_logical_ldio which I think were obtained from another thread on redirecting 0,6 to the same console.

Thanks in advance.

I probably should add some more detail here. This piece of code is running as a dll and the actual error message is
forrtl:severe(38): error during write, unit 6, file CONOUT$

The actual open code is
open (unit=6, FILE=trim(logName), ACCESS='APPEND', STATUS='UNKNOWN', SHARED)

thanks again.
0 Kudos
Lorri_M_Intel
Employee
1,004 Views

Do you actually have a console open?

If this is a DLL, that's not true by default. You will have to use the AllocConsole call. I haven't done this in a while, but you do something similar to this code snippet. The interesting parts are in blue.

subroutine mysub()
use ifwin

integer status

status = AllocConsole()

write (*,*) "Hello world!"

FreeConsole()

return

- Lorri
0 Kudos
Reply