Xiaogang Wang said:
> Is there a command in F90 that can skip some records when reading a
> SEQUENTIAL and UNFORMATTED file?
Yes.
> Not able to find such a command, I have to
> settle with reading and discarding the records I want to skip.
You don't have to read them, just discard them.
Just use READ with no input-list.
> But why there
> isn't such a command in F90 that goes directly to where the wanted record is.
> Is this problem more acute when each record is very long (say, a million
> element)?
You can only go directly to the wanted record if all the records are
the same size, in which case you should consider access='DIRECT'.
> -------------------------------------------------
> Only the 10th record of the binary file is read in,
> done by the following code:
> -------------------------------------------------
>
> real vector(1000000)
> open(11,file='test',access='sequential',FORM='UNFORMATTED')
> do i = 1, 9
READ(11)
> end do
> read(11) vector ! this is the 10th record I need
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
|