2 ! PR 21875 : Test formatted input/output to/from character arrays.
3 ! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
7 character(12) :: r(12,2) = '0123456789AB'
9 ! Write to and read from a whole character array
12 write(r
,'(3(2x,i4/)/3(3x,i6/))') i
14 read(r
,'(3(2x,i4/)/3(3x,i6/))') i
15 if (any(i
.ne
.(/(j
,j
=1,6)/))) call abort()
18 if ((j
.gt
.8.and
.k
.eq
.1).or
.(k
.eq
.2)) then
19 if (r(j
,k
).ne
.'0123456789AB') call abort()
24 ! Write to a portion of a character array
26 write(r(3:9,1),'(6(i12/))') i
27 if (r(2,1).ne
.'0123456789AB') call abort()
29 if (iachar(trim(adjustl(r(j
,1))))-46.ne
.j
) call abort()
31 if (r(9,1).ne
.' ') call abort()