Hi, i have a simple question that I know is easy for most of u
I am not an expert programmer but even if u dont know FTN u may gimme a hint on the algorithm and I will figure that out how to do it in FTN
I have a file like
nx=300 ny=12 f=1e4
sad=34.2 nj=23 jb=234
and so on
now I want the code to read 300 and put it into a previous defined integer variable called nx and so on to the end of the file
should I read it character by character ??
how to go to next line??
how to ignore blanks while reading
what size should I use, as each time I may want to for instance, change the value of nx to 200
how to ignore blank lines
I appreciate if somebody can help me
Best,
inmiiz@yahoo.com
Comments
The short answer is that ypu can't, Fortran's format function only works on fixed length fields. By far the easiest solution will be to pad ypur input file with spaces and then just read in with a format.
Of course Fortran 77 is a Turing-complete programming language, which means that any computable function can be calculated if you try hard enough. So reading in as a character*1 string and processing character-by character will work (you jump to ypur integer / float prasing subroutine on hitting the first integer, and jump out of it on hitting the first non-number character).
It is extremely fiddly and almost certainly not worth your while.