RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.BlockWrite Function

Writes one or more records from a variable to an open file.

Pascal
procedure BlockWrite(var f: File; var Buf; Count: Integer); overload;
procedure BlockWrite(var f: File; var Buf; Count: Integer; var AmtTransferred: Integer); overload;
C++
BlockWrite(File f,  Buf, int Count);
BlockWrite(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. 

BlockWrite writes Count or fewer records to the file F from memory, starting at the first byte occupied by Buf. The actual number of complete records written (less than or equal to Count) is returned in AmtTransferred.  

The entire block transferred occupies at most Count * RecSize bytes. RecSize is the record size specified when the file was opened (or 128 if the record size was unspecified).  

If the entire block is transferred, AmtTransferred is equal to Count on return.  

If AmtTransferred is less than Count, the disk became full before the transfer was complete. In this case, if the file's record size is greater than 1, AmtTransferred returns the number of complete records written. 

BlockWrite advances the current file position by AmtTransferred records. 

If AmtTransferred isn't specified, an I/O error occurs if the number written 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!