Reads bytes from a file opened by low-level access
FREAD( <nHandle>, @<cBuffer>, <nBytes> ) --> nBytes
<nHandle> Dos file handle
<cBuffer> Character expression passed by reference.
<nBytes> Number of bytes to read.
<nBytes> the number of bytes successfully read from the file. <nHandle>
This function reads the characters from a file whose file handle is <nHandle> into a character memory variable expressed as <cBuffer>. The function returns the number of bytes successfully read into <cBuffer>.
The value of <nHandle> is obtained from either a call to the FOPEN() or the FCREATE() function.
The <cBuffer> expression is passed by reference and must be defined before this function is called. It also must be at least the same length as <nBytes>.
<nBytes> is the number of bytes to read, starting at the current file pointer position. If this function is successful in reading the characters from the file, the length of <cBuffer> or the number of bytes specified in <nBytes> will be the value returned. The current file pointer advances the number of bytes read with each successive read. The return value is the number of bytes successfully read from the file. If a 0 is returned, or if the number of bytes read matches neither the length of <cBuffer> nor the specified value in <nBytes> an end-of-file condition has been reached.
#include "fileio.ch" cBuffer := Space( 500 ) IF ( nH := FOpen( "x.txt" ) ) == F_ERROR FRead( nH, @cBuffer, 500 ) ? cbuffer ENDIF FClose( nH )
Library is rtl