Reading from the special file

Several subroutines allow reading data from a tape. The basic read command is
count=read(tapefd, buffer, numbytes);

The read operation returns the number of bytes read during the operation. It can be less than the value in numbytes. If the block size is fixed (block_size≠0), the numbytes value must be a multiple of the block size. If the count is less than zero, the errno value contains the error code that is returned from the driver.

See Return codes for a description of the errno values.

If the block size is variable, then the value that is specified in numbytes is read. If the blocks read are smaller than requested, the block is returned up to the maximum size of one block. If the blocks read are greater than requested, an error occurs with the error set to ENOMEM.

Reading a filemark returns a value of zero and positions the tape after the filemark. Continuous reading (after EOM is reached) results in a value of zero and no further change in the tape position.

The readv subroutine is also supported.