BlockWrite (procedure)


 BlockWrite (procedure)

Writes one or more records from a variable.


 procedure BlockWrite(var f: File; var Buf; Count: Word [; var Result:


   F        untyped file variable
   Buf      any variable
   Count    an expression of type Word
   Result   a variable of type Word


Windows, Real, Protected


F is an untyped file variable, Buf is any variable, Count is an expression of type Word, and Result is a variable of type Word.

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 the optional parameter Result. If Result is not specified, an I/O error occurs if the number written is not equal to Count.

The entire block transferred occupies at most Count symbol *RecSize bytes, where RecSize is the record size specified when the file was opened (or 128 if the record size was unspecified). An error occurs if Count symbol *RecSize is greater than 65,535 (64K).

Result is an optional parameter. If the entire block was transferred, Result will be equal to Count on return. Otherwise, if Result is less than Count, the disk became full before the transfer was completed. In that case, if the file's record size is greater than 1, Result returns the number of complete records written.

The current file position is advanced by Result records as an effect of the BlockWrite.

With {$I-}, IOResult returns 0 if the operation succeeded; otherwise, it returns a nonzero error code.


File must be open.

See Also

Sample Code

Тэги: BlockWrite
| G+
Код для вставки: :: :: :: ::
Поделиться: // //