AsyncReadBlockFile

# AsynchReadBlockFile

Reads data blocks from file.

### Synopsis

`int32 AsynchReadBlockFile (BlockFilePtr bf, Item ioreqItem, void* buffer, long count, long offset)`

### Description

Reads a number of data blocks from the specified block file. `AsynchReadBlockFile()` calls `SendIO()` to make an asynchronous Portfolio I/O request for the data.

Because `AsynchReadBlockFile()` reads only whole blocks from the specified file, it reads the first whole block containing the location specified by `offset` (that is, it begins to read data blocks at the block margin prior to the specified byte location).

The file must be opened by `OpenBlockFile()` before `AsynchReadBlockFile()` can read data blocks from it.

### Arguments

`bf`
  Pointer to the block file.

`ioreqItem`
  Item of the I/O request.

`buffer`
  Pointer to buffer into which the data blocks are read.

`count`
  Number of bytes that are read.

`offset`
  Location at which the first block is read, measured in bytes from the start of the file.

### Return Value

Value
  Error Condition

0
  None (the I/O request has not completed)

1
  None (the I/O request has already completed)

(Portfolio error code)
  `SendIO()` failed

`AsynchReadBlockFile()` does not return the value of the `io_Error` field to which returns the status of the I/O request.

See "Error Messages" in the 3DO Portfolio Reference Manual for a listing of error messages returned by `CreateItem()`.

### Caveats

This function only works when called with a count that's the multiple of the cel's blocksize.

### Associated Files

BlockFile.h

### See Also

`OpenBlockFile`, OwnAudioClock, SendIO