I've read() down past a header of an input file, and read the value of L on the way.
Now I come to a line of L^2 consecutive reals, which I need to input to the elements of an allocatable array A(L,L).
Trying
character *100 :: buffer
read (1,10) buffer
10 format(a(L*10))
results in
Error: Syntax error in FORMAT statement at (1)
Error: FORMAT label 10 at (1) not defined
but I'm not sure how else to deal with a (hugely) variable number of reals.
Trying:
do i=1,L
do j=i,L
read (1,"(f10.7)") buffer
read (buffer,*) A(i,j)
enddo
enddo
throws:
Fortran runtime error: Expected REAL for item 2 in formatted transfer, got CHARACTER
(f10.7)
I can't simply read(1,"(a1000)") as L will eventually end up huge, so what I really need is a way to parse the elements one by one.
Please say there's a way?