# _CP_send

_CP_send is equivalent to the `send{x} *string*{:} to *port.number*` BASIC statement.

## Syntax

```
int _CP_send(int type, CPSTR* string, int port.number)
```
The type parameter is a bit mask to
set various options that can be the combination of a logical or operation:

| _CP_SEND_X | Requests the sendx form of send. |
| --- | --- |
| _CP_SEND_N | Suppresses the new line. |
| _CP_SEND_ELSE | Indicates an else condition. |

## Description

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

## Example(s)

```
/* Sends "hi" to port 1. */

CPSTR * s = _CP_mkstr("dev-att 1");
CPSTR * t = _CP_mkstr("hi");
CPSTR * c = _CP_str_null;
CPSTR * r = _CP_str_null;

_CP_execute(_CP_EXECUTE_C,s,&c,&r);
_CP_send(0, t, 1);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)

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