Function FRead() Foundation
Reads a character string from a file into a memory variable.
FRead( <nHandle>, @<cBuffer>, <nBytes> ) --> nBytes
|FH_STDERR *)||Standard error|
FRead() returns an integer numeric value. It corresponds to the number of bytes which could actually be read from the file. The return value should be the same as the value of <nBytes>. A return value less than <nBytes> indicates that the end of the file was reached or a read error occurred.
The low level file function FRead() reads characters from a file into a memory variable previously initialized to be long enough to hold the data. <nBytes> characters are read starting at the current file pointer position.
The file pointer is moved forward <nBytes> by the read process, unless the end of the file is reached. FRead() reads all characters, including Chr(0), into the memory variable. This differs from the function FReadStr(), which stops reading characters from the file when the character Chr(0) is found. To move the file pointer without reading characters, the function FSeek() is used.
When FRead() reaches the end of the file, the function returns a value less than <nBytes> and the return value of the function FError() is zero. If an error occurs during the read, FRead() also returns a value less than <nBytes>, but FError() provides an error code not equal to zero.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.