For Programmers: Free Programming Magazines  


Home > Archive > Fortran > February 2007 > Re: Reading unknown number of values in unformatted file [SOLUTION]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Reading unknown number of values in unformatted file [SOLUTION]
Patrick Begou

2007-02-07, 7:06 pm

Warner BRUNS wrote:
>
> Hello,
>
> When I have to read an amount of data which depends on one the items
> to be read, I use BACKSPACE.


Thanks a lot for this idea, Warner. I was'nt knowing this fortran
statment! I should have read in more details the "Metcalf & al." book....

The final solution I used is:
INTEGER ::count
REAL ::w1,w2,w3
..........
READ(11,iostat=count) w1,w2,w3
IF (count.NE.0) THEN
w3=-1.0
backspace(11)
READ(11,err=111,end=112) w1,w2
ENDIF
....
and error processing for 111 and 112 labels.

Thanks all for your helpfull advices.

Patrick
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com