Hi,
Is there a command in F90 that can skip some records when reading a
SEQUENTIAL and UNFORMATTED file? Not able to find such a command, I have to
settle with reading and discarding the records I want to skip. 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)?
Example:
-------------------------------------------------
The binary file is produced by the following code:
-------------------------------------------------
real vector(1000000)
open(11,file='test',access='sequential',FORM='UNFORMATTED')
do i = 1, 10
vector = [some random numbers]
write(11) vector
end do
close(11)
-------------------------------------------------
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
write(11) vector ! read and discard the first 9 records
end do
read(11) vector ! this is the 10th record I need
close(11)
Thanks.
Xiaogang
------------------------------------------------
Dr Xiaogang Wang
Departement de chimie
Universite de Montreal
C.P. 6128, succursale Centre-ville
Montreal (Quebec) H3C 3J7
Tel. (514) 3436111 ext 3947 (office)
FAX (514) 3437586 (office)
e-mail: [log in to unmask]
homepage: http://www.esi.umontreal.ca/~wangx
------------------------------------------------
|