How to read data from a file with different column in a line

1838409@uni-wuppertal.de 1838409@uni-wuppertal.de
Fri Jul 26 06:50:00 GMT 2019


Dear Sir/Madam;
I want to read data from a file in which every line has different  
number of data, e.g.

a b c d
e f
h g k

and I need to have format like this format(T8,<num>(I7)) which <num>  
is dynamic format specifier determined in run time which specified  
number of column in a row of input file. This is the code I want to  
modified. The code worked in Intel fortran, but in gfortran I got error.

do i=1,N
      read(20,'(I7)') CV(i,1)

      backspace(20)
      15 format(T8,CV(i,1)(I7))
      read(20,15) CV(i,2:CV(i,1)+1)
end do

I'd really appreciate it if you could help me.

Regards,
Mehdi Baba Mehdi




More information about the Fortran mailing list