3 ! Tests dtio of transfer bind-C types.
5 ! Note difficulties with c_char at -O1. This is why no character field is used.
9 TYPE, BIND(C
) :: person
10 integer(c_int
) :: id_no
13 INTERFACE WRITE(UNFORMATTED
)
16 INTERFACE READ(UNFORMATTED
)
22 SUBROUTINE pwuf (dtv
,unit
,iostat
,iomsg
)
23 type(person
), INTENT(IN
) :: dtv
24 INTEGER, INTENT(IN
) :: unit
25 INTEGER, INTENT(OUT
) :: iostat
26 CHARACTER (LEN
=*), INTENT(INOUT
) :: iomsg
27 WRITE (UNIT
=UNIT
) DTV
%id_no
, DTV
%age
30 SUBROUTINE pruf (dtv
,unit
,iostat
,iomsg
)
31 type(person
), INTENT(INOUT
) :: dtv
32 INTEGER, INTENT(IN
) :: unit
33 INTEGER, INTENT(OUT
) :: iostat
34 CHARACTER (LEN
=*), INTENT(INOUT
) :: iomsg
35 READ (UNIT
= UNIT
) dtv
%id_no
, dtv
%age
42 TYPE (person
) :: chairman
43 CHARACTER (kind
=c_char
) :: cname(20)
44 integer (c_int
) :: cage
, cid_no
49 chairman
%id_no
= cid_no
52 OPEN (UNIT
=71, status
= 'scratch', FORM
='UNFORMATTED')
62 write(line
, "(I4)") chairman
%id_no
63 if (trim (line
) .ne
. " 1") call abort
64 write(line
, "(I4)") chairman
%age
65 if (trim (line
) .ne
. " 62") call abort