READF@

Platform

x64, Win32

Purpose

To read binary data from a file.

Syntax

SUBROUTINE READF@(DATA, SID, NBYTES, NBYTES_READ, ERROR_CODE)
CHARACTER (LEN=*) DATA
INTEGER (KIND=2) SID, ERROR_CODE
INTEGER (KIND=3) NBYTES, NBYTES_READ

Description

This routine reads NBYTES of data from an open file with a given system identier SID. ERROR_CODE is returned as zero for success or a system error code. If end of file is reached, NBYTES_READ is returned as -1, with an ERROR_CODE of zero. Also NBYTES_READ may be returned as less than NBYTES. This routine should be used on binary data.

Notes

If the input value of NBYTES is supplied as a constant and the compiler option /INTS is used, it will be necessary to force the length of the constant to 4 bytes.

If compiling for 64-bits (only) there is an extra long version of this routine that can read data chunks in excess of 2GB:

SUBROUTINE READFLONG@(DATA, SID, NBYTES, NBYTES_READ, ERROR_CODE)
CHARACTER (LEN=*) DATA
INTEGER (KIND=2) SID, ERROR_CODE
INTEGER (KIND=4) NBYTES, NBYTES_READ

See also

OPENR@, OPENRW@, OPENW@, READFA@, WRITEF@, WRITEFA@, CLOSEF@, FPOS@, FPOS_EOF@

 

 

Basket
Empty
 
Copyright © 1999-2020 Silverfrost Limited