A subroutine which can be called from FORTRAN to read a block of bytes from an unblocked binary file. The return status code must be checked after calling the subroutine. (Note that this routine behaves differently from PBREAD on hitting end-of-file.)
The format and arguments for the subroutine are:
SUBROUTINE PBREAD2( KUNIT, KARRAY, KOUNT, KRET)
Input parameters are INTEGERs.
KUNIT | Index of a C file pointer obtained from PBOPEN |
KOUNT | The number of BYTES to read from the file |
Output parameters are INTEGERs.
KARRAY | An integer array to accept the bytes read |
KRET | Status return code: >=0, number of bytes read from the file. If end-of-file is encountered, KRET returns the number of bytes actually read. To detect EOF, the caller must check this value against the number of bytes requested -2, error in reading the file |