wronski123
Technical User
Dear forum members
I have recently encountered a problem when trying to write arrays on a fortran formatted output file. I have arrays which are either integer or real, with the following descriptors F10.11 I20. If I try to print them with formatted print statement I obtain blanks, if I run out of array elements. Do you have idea how to overcome this. I have figured out a way how to do it with implied do loop and counting the number of remaining elements in the array, but I hope to find some more elegant solution here.
I am including small fortran source pls look at it’s output in order to see what my problem is.
Thank you in advance
Wronski
program main
implicit none
integer :: a(10)=99999,i,sb(10)=88888
real :: b(15) = 9.12345678911E+03
open(unit=111,file='test_fortran_print.txt',status='replace',action='write')
write(111,'(4I20)') a
write(111,'(4ES20.12)') b
write(111,'(4I20)') sb
close(111)
end program
I have recently encountered a problem when trying to write arrays on a fortran formatted output file. I have arrays which are either integer or real, with the following descriptors F10.11 I20. If I try to print them with formatted print statement I obtain blanks, if I run out of array elements. Do you have idea how to overcome this. I have figured out a way how to do it with implied do loop and counting the number of remaining elements in the array, but I hope to find some more elegant solution here.
I am including small fortran source pls look at it’s output in order to see what my problem is.
Thank you in advance
Wronski
program main
implicit none
integer :: a(10)=99999,i,sb(10)=88888
real :: b(15) = 9.12345678911E+03
open(unit=111,file='test_fortran_print.txt',status='replace',action='write')
write(111,'(4I20)') a
write(111,'(4ES20.12)') b
write(111,'(4I20)') sb
close(111)
end program