Newbie on the lose.. How to add an unknown length dataset to an array



Hi

I learning fortran at the moment as part of my physics study, and I love the
language so far, anyway...

I have a small project where I need to analyze some data in the form of 1-D
unformated text, I know how to do that, and for a fixed size dataset I
wouldn't have a problem, but I want to do unknown length datasets (otherwise
I don't really have anything useful) So I came up with a simple rotating
allocatable array scheme, something like:

read a line to array "a"
now do array "b" = "a"
deallocate a
allocate a(size(b)+1)
a = b
deallocate b

and so on...
Quite simple and it works.. but is it effective? can some of you magicians
share with me how to do it "right"? would it be better to pase the text file
first to find the length of it? (the data is not of equal length so I can't
use the file-size directly)

Any feedback is much appreciated :)


Morten
http://mdj.dk


.