HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
BUFFER IN (extension)
Chapter 10286
PROGRAM bufferedIoTest
! buffered i/o example: compile with +autodbl
INTEGER a(10)
OPEN ( UNIT = 7, NAME = ’test.dat’, FORM = ’UNFORMATTED’ )
a = (/ (i,i=1,10) /) ! initialize the array A
BUFFER OUT ( 7, 0 ) ( a, a(10) ) ! write out A twice
CALL unit ( 7 )
BUFFER OUT ( 7, 0 ) ( a, a(10) )
CALL unit ( 7 )
! now position the file 40 bytes (5 integer values) into the file
CALL setpos ( 7, 5 )
! read the remainder of the 1st record, and half of the second
BUFFER IN ( 7, 0 ) ( a, a(10) )
WRITE(6,*) a
CLOSE (7)
END PROGRAM bufferedIoTest
Related statements
BUFFER OUT