2 ! Test the error message when an unformatted file has become
6 integer(kind
=4) :: i1
, i2
8 character(len
=50) :: msg
10 ! Write out a truncated unformatted sequential file by
11 ! using unformatted stream.
13 open (10, form
="unformatted", access
="stream", file
="foo_unf_read_corrupted_1.dat", &
16 close (10, status
="keep")
19 open (10, file
="foo_unf_read_corrupted_1.dat", form
="unformatted", access
="sequential")
22 read (10, iostat
=ios
, iomsg
=msg
) i1
, i2
25 if (msg
/= "Unformatted file structure has been corrupted") STOP 3
26 close (10, status
="delete")