Reads one or more records from an open file into a variable.
procedure BlockRead(var F: File; var Buf; Count: Integer); overload; procedure BlockRead(var F: File; var Buf; Count: Integer; var AmtTransferred: Integer); overload;
BlockRead(File F, Buf, int Count); BlockRead(File F, Buf, int Count, int AmtTransferred);
System
F is an untyped file variable, Buf is any variable, Count is an expression of type Integer, and AmtTransferred is an optional variable of type Integer.
BlockRead reads Count or fewer records from the file F into memory, starting at the first byte occupied by Buf. The actual number of complete records read (less than or equal to Count) is returned in AmtTransferred.
The entire transferred block occupies at most Count * RecSize bytes. RecSize is the record size specified when the file was opened (or 128 if the record size was not specified).
If the entire block was transferred, AmtTransferred is equal to Count.
If AmtTransferred is less than Count, ReadBlock reached the end of the file before the transfer was complete. If the file's record size is greater than 1, AmtTransferred returns the number of complete records read.
If AmtTransferred isn't specified, an I/O error occurs if the number of records read isn't equal to Count. If the $I+ compiler directive is in effect, errors raise an EInOutError exception.
TFileStream
EInOutError
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|