A subroutine which can be called from FORTRAN to position an unblocked binary file at any desired byte position. The return status code must be checked after calling the subroutine.
The format and arguments for the subroutine are:
SUBROUTINE PBSEEK( KUNIT, KOFFSET, KSTART, KRET)
Input parameters are INTEGERs.
KUNIT | Index of a C file pointer obtained from PBOPEN |
KOFFSET | The number of bytes to offset the file; this is either an absolute or relative offset depending on the value of KSTART |
KSTART | 0, use KOFFSET as an absolute offset from the beginning of the file 1, use KOFFSET as a relative offset from the current byte position in the file 2, use KOFFSET as an absolute offset counting backwards from the end of the file |
The output parameter is an INTEGER.
KRET | Status return code >= 0, byte offset from the start of the file after positioning -1, end-of-file is hit whilst positioning to the given byte offset -2, error in positioning the file |