Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
BlockWrite Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Arguments
filename Untyped file; destination of copying procedure
buffer Any variable; source of copying procedure
count Integer expression; number of blocks to be copied
result Optional; number of complete blocks copied
Description
The BlockWrite procedure copies one or more blocks from a
user-defined buffer to an untyped file. Before using BlockWrite,
Assign the file, then Reset or Rewrite the file. After BlockWrite,
the current position in the file advances the number of blocks
given by result.
BlockWrite copies data in blocks of size specified when the file
was opened with the Reset or Rewrite procedures. If no size is
specified, BlockWrite uses a default size of 128 bytes. The block
size may be specified to match the size of records to be stored
in the file as long as the size is less than 64K.
Beginning at the first byte of the buffer, BlockWrite copies
successive blocks to the file. Since BlockWrite does not perform
range checking, make sure that the buffer size in bytes equals or
exceeds the product of count and the block size.
If the result argument is passed, BlockWrite sets result to the
number of complete blocks copied. The number of bytes copied is, at
most, the product of count and the block size. The number of bytes
copied must not exceed 64K. If the disk becomes full, BlockWrite
sets result to the number of blocks actually written.
If result is not passed and the number of complete blocks copied is
less than count, an I/O error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.