# _CP_readt

_CP_readt is equivalent to the readt BASIC statement.

Which flavor of readt is dependent
upon the command type:

| Type | BASIC Statement |
| --- | --- |
| _CP_READT_ELSE | readt result else * return -1 |
| _CP_READT_L_ELSE | readtl result else * return -1 |
| _CP_READTX_ELSE | readtx result else * return -1 |
| _CP_READT_ONERR | readt result onerr * return -1 |
| _CP_READT_L_ONERR | readtl result onerr * return -1 |
| _CP_READTX_ONERR | readtx result onerr * return -1 |

## Syntax

```
int _CP_readt(int type, CPSTR** result)
```

## Description

This function returns -1 if
an error occurs. The error code is contained in _CP_errno. PE_TAPE indicates a tape error.

Note: The tape
must have been already attached.

## Example(s)

```
/* Prints the next tape block. */

CPSTR * xx = _CP_str_null;

_CP_readt(_CP_READT_ELSE, xx);
_CP_print(xx);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_weof](https://d3codex.com/cfunctions/cp-weof/)
- [_CP_writet](https://d3codex.com/cfunctions/cp-writet/)

---
Source: https://d3codex.com/cfunctions/cp-readt/ - part of the D3Codex reference.
