Fortran Library Reference

fseeko64: Reposition a File on a Logical Unit

The function is called by:

INTEGER fseeko64

n = fseeko64( lunit, offset64, from )

lunit

INTEGER*4

Input  

Open logical unit  

offset64

INTEGER*8

Input  

64-bit offset in bytes relative to position specified by from

from

INTEGER*4

Input  

0=Beginning of file  

1=Current position  

2=End of file  

Return value 

INTEGER*4

Output  

n=0: OK; n>0: System error code


Note -

On sequential files, following a call to fseeko64 by an output operation (e.g. WRITE) causes all data records following the fseek position to be deleted and replaced by the new data record (and an end-of-file mark). Rewriting a record in place can only be done with direct access files.


Example: fseeko64()--Reposition MyFile to two bytes from the beginning:


    INTEGER fseeko64, lunit/1/, from/0/, n
    INTEGER*8 offset/200/
    open( UNIT=lunit, FILE='MyFile' )
    n = fseeko64( lunit, offset, from )
    if ( n .gt. 0 ) stop 'fseek error'
    end