You have a few problems with your posted code.
Try:
WRITE(*,'(I0,1x, F20.15)') icoun, array(icoun)
The following code may give a clue to a related problem using read ( fmt=*.
real, allocatable :: array(:)
integer n, icoun, lu, iostat
character line*80
n = 20
allocate ( array(n) )
call random_number ( array )
write (*,*) 'Print results'
DO icoun=1,UBOUND(array,1)
WRITE(*,'(i0,1x,F20.15)') icoun, array(icoun)
END DO
write (*,*) 'OPEN file'
lu = 11
open (unit=lu, file='array.txt' )
write (*,*) 'Write results to file'
DO icoun=1,UBOUND(array,1)
WRITE (lu,'(i0,1x,F20.15)') icoun, array(icoun)
END DO
close (lu)
write (*,*) 'Read results from file using fmt=*'
open (unit=lu, file='array.txt' )
do
read (lu, fmt=*, iostat=iostat) line
if ( iostat /= 0) exit
write (*,*) trim (line)
end do
close (lu)
write (*,*) 'Read results from file using fmt=(a)'
open (unit=lu, file='array.txt' )
do
read (lu, fmt='(a)', iostat=iostat) line
if ( iostat /= 0) exit
write (*,*) trim (line)
end do
end
Note : Read ( * is terminated by a blank