Compatibility between Compaq Visual Fortran and gfortran
Paul Thomas
paulthomas2@wanadoo.fr
Tue Feb 15 15:42:00 GMT 2005
Jens,
For my taste, the neatest solution would be to take my example and transfer
the vector buffer in to the array, for each line read. Tested but without
any warranty:
program read_character
implicit none
character(len=4) :: ch(8)
integer, dimension(10) :: nbuf
integer, dimension(10, 20) :: npar
integer :: i
equivalence (ch,nbuf(3))
open (unit = 10, file = 'test.par', status = 'old')
do i = 1, 20
read (10, '(2I3, 2X, 8A4)') nbuf(1:2), ch(1:8)
npar(:, i) = nbuf
end do
close(10)
write (*,'(2i3,8z8)') npar !check read is correct
end program read_character
It has the advantage of being standard fortran and being easy to understand.
The buffer transfers will take a relatively miniscule amount of time to
execute.
More information about the Fortran
mailing list