Compatibility between Compaq Visual Fortran and gfortran

Paul Thomas paulthomas2@wanadoo.fr
Tue Feb 15 13:35:00 GMT 2005


Jens,

This is the way to do it:

program read_character
  implicit none
  character(len=4)      :: ch(8)
  integer, dimension(10) :: npar
  equivalence (ch,npar(3))                                  ! equivalence 
last 8 npar to character
  integer                    :: i
  open (10, status = 'scratch')
  write (10,'(A40)')'120 35  TESTTESTTESTTESTTESTTESTTESTTEST'
  rewind (10)
  read (10, '(2I3, 2X, 8A4)') npar(1:2),ch(1:8)   ! read as 2 integers and 8 
characters
  close (10)
  print '(i3,1x,i3,8(1x,z8))', npar                         ! check the 
result
  print *, ch                                                         ! 
bis
end program read_character

Best regards

Paul Thomas 




More information about the Fortran mailing list