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.
BlockRead Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Arguments
filename Untyped file; source of copying procedure
buffer Any variable; destination of copying procedure
count Integer expression; number of blocks to be copied
result Optional; number of complete blocks copied
Description
The BlockRead procedure copies one or more blocks from an untyped
file to a user-defined buffer. Before using BlockRead, Assign the
file, then Reset the file. After BlockRead, the current position in
the file advances the number of blocks given by result.
BlockRead copies data in blocks of size specified when the file was
opened with the Reset procedure. If no size was specified,
BlockRead uses a default size of 128 bytes. The block size may be
specified to match the size of records stored in the file, as long
as the size is less than 64K.
Beginning at the first byte of the buffer, BlockRead fills as much
memory as needed. Since BlockRead 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, BlockRead sets result to the
number of complete blocks copied, excluding any last partial
block. If the file size is not a multiple of the block size, a
partial record remains unread in the file.
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.