| 1 |
! { dg-do run } |
| 2 |
! PR25828 Stream IO test 4, Tests string read and writes, single byte. |
| 3 |
! Verifies buffering is working correctly and position="append" |
| 4 |
! Contributed by Jerry DeLisle <[email protected]>. |
| 5 |
program streamtest |
| 6 |
implicit none |
| 7 |
character(1) :: lf = char(10) |
| 8 |
character(1) :: tchar |
| 9 |
integer :: i,j,k |
| 10 |
integer, parameter :: lines = 5231 |
| 11 |
|
| 12 |
open(10, file="teststream_streamio_4", access="stream", form="formatted") |
| 13 |
|
| 14 |
do i=1,lines |
| 15 |
do j=0,9 |
| 16 |
write(10,"(i5)") j |
| 17 |
end do |
| 18 |
end do |
| 19 |
|
| 20 |
close(10) |
| 21 |
|
| 22 |
open(10, file="teststream_streamio_4", access="stream",& |
| 23 |
&form="formatted", position="append") |
| 24 |
do i=1,lines |
| 25 |
do j=0,9 |
| 26 |
write(10,"(i5)") j |
| 27 |
end do |
| 28 |
end do |
| 29 |
rewind(10) |
| 30 |
do i=1,lines |
| 31 |
do j=0,9 |
| 32 |
read(10,"(i5)") k |
| 33 |
if (k.ne.j) STOP 1 |
| 34 |
end do |
| 35 |
end do |
| 36 |
|
| 37 |
close(10,status="delete") |
| 38 |
end program streamtest |