| 1 |
! { dg-do run } |
| 2 |
! Test that we can write an unformatted stream file without |
| 3 |
! truncating. |
| 4 |
program main |
| 5 |
character (len=10) c |
| 6 |
open(10, form="unformatted", access="stream", position="rewind") |
| 7 |
write (10) '1234567890abcde' |
| 8 |
c = '' |
| 9 |
read (10,pos=1) c |
| 10 |
if (c /= '1234567890') STOP 1 |
| 11 |
c = '' |
| 12 |
read (10,pos=6) c |
| 13 |
if (c /= '67890abcde') STOP 2 |
| 14 |
write (10,pos=3) 'AB' |
| 15 |
c = '' |
| 16 |
read (10,pos=1) c |
| 17 |
if (c /= '12AB567890') STOP 3 |
| 18 |
c = '' |
| 19 |
read (10,pos=6) c |
| 20 |
if (c /= '67890abcde') STOP 4 |
| 21 |
close (10,status="delete") |
| 22 |
end program main |