# _CP_weof

_CP_weof is equivalent to the weof BASIC statement.

## Syntax

```
 int _CP_weof(int type)
```

## Parameter(s)

| Type | BASIC Statement |
| --- | --- |
| _CP_WEOF_ELSE | weof else return -1 |
| _CP_WEOF_ONERR | weof onerr return -1 |

## Description

This function returns -1 if
an error occurs. The error code usually returned in system(0) is contained in _CP_errno. PE_TAPE indicates a tape error.

Note: The tape must have already been
attached.

## Example(s)

```
 /* Writes an eof on the tape. */
 _CP_weof(_CP_WEOF_ELSE);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_readt](https://d3codex.com/cfunctions/cp-readt/)
- [_CP_rewind](https://d3codex.com/cfunctions/cp-rewind/)
- [_CP_system](https://d3codex.com/cfunctions/cp-system/)
- [_CP_writet](https://d3codex.com/cfunctions/cp-writet/)

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