FREAD()
Reads bytes from a file opened by low-level access
Syntax
FREAD( <nHandle>, @<cBuffer>, <nBytes> ) --> nBytes
Arguments
<nHandle> Dos file handle
<cBuffer> Character expression passed by reference.
<nBytes> Number of bytes to read.
Returns
<nBytes> the number of bytes successfully read from the file. <nHandle>
Description
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.
Examples
#include "fileio.ch" cBuffer := Space( 500 ) IF ( nH := FOpen( "x.txt" ) ) == F_ERROR FRead( nH, @cBuffer, 500 ) ? cbuffer ENDIF FClose( nH )
Compliance
Clipper
Platforms
All (64K)
Files
Library is rtl
Seealso
Pingback: Harbour All Functions – F | Viva Clipper !
Pingback: Harbour Files and Folders Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !