> Subject: Advice required for fortran90
> From: Assefaw Hadish Gebremedhin <[log in to unmask]>
> To: [log in to unmask]
You don't need to know how many lines there are.
After allocating total, just
read *, total
> I have a list of integers file with the following information. The first
> line has two integres - the total number of lines in the file and the
> total number of integres listed in the file.
> Then comes the list of integers, listed line after line. The number of
> integers per line is not known before hand.
>
> Example
> 7 22
> 5 3 2
> 1 3 4
> 5 4 2 1
> 2 3 6 7
> 1 3 6
> 5 4 7
> 6 4
>
> I want to read this file and develop a datastructure in which the numbers
> are read into an array (called total) of exact size and the number of
> integers per line is registered in another array (called line).
> This is how I started.
> Read the first line and allocate the arrays total and line.
> For the above example, the following is done
> allocate(total(22))
> allocate(line(7))
>
> Reading the rest of the file into total is easy. I have a problem with
> reading data into line. How does one read a list of input of unknown size
> in fortran90?
>
> regards
> Assefaw Hadish
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|