Re: Need clarification on unformatted IO
Jason C wrote:
I am trying to read in a unformmated sequentail binary file generated
from someone else's code.
In his code, he has something like:
do j = 1, total
write(12) (buffer(i), i = 1, total2)
enddo
Here's my question:
When I try to read in the content of the file with the following code,
it crashes (segmentation fault):
do i = 1, total
read(12) differ_buffer(1:total2)
end do
However, if I use the following code, I can complete the read call:
do i = 1, total
read(12) (differ_buffer(j), j = 1, total2)
end do
I would have thought so, but my usual rule is that the READ
should look just like the WRITE, except for the obvious changes.
From what I've read from Fortran 90, don't the following code
fragements the same thing?
differ_buffer(A:B)
and
do i = A,B
differ_buffer(i)
enddo
You mean:
DO I=A,B
READ(12) BUFFER(I)
ENDDO
no, that would be different. It is one record per READ or
WRITE statement.
and
differ_buffer(i), i = A,B
-- glen
.