c_tpread - Reads from tape

SYNTAX

#include "tapeio.h"

FUNCTION c_tpread (unit, buffer, bufsz, mode)

     long            *unit;
     unsigned char   *buffer;
     long            *bufsz;
     long            *mode;

PARAMETERS

unit (input, integer)

Unit number to be used as a reference for the drive. This number is set by c_tpopen() and should not be altered.

buffer (input, array)

User's buffer to which the data is written.

bufsz (input, integer)

The maximum number of bytes to be read from tape. Bufsz bytes for which parameter buffer is 32K.

mode (input, integer)

A value of HANDLE (1) specifies that when an error occurs the routine is to return an error to the calling program and display a message to the terminal.

DESCRIPTION

The c_tpread() call is used to read bufsz bytes from a tape device. When issuing a c_tpread() call for less than the whole record size, the remaining, the remaining bytes are lost. Issuing a c_tpread() with a greater number of bytes than record size returns the actual number of bytes read. A call to c_tpread() is needed after the last data record to identify end of file.

RETURN VALUE

c_tpread() returns

     the number of bytes actually read
     TAPE_EOV    -->  end of volume detected
     TAPE_EOT    -->  hardware end of tape
     TAPE_EOF    -->  end of file
     TPREAD_READ -->  device error