# _CP_writev

_CP_writev is equivalent to the writev and writevu BASIC statements.

| Type | BASIC Statement |
| --- | --- |
| _CP_WRITEV | writev string1 on expression1,string2,expression2 |
| _CP_WRITEUV | writevu string1 on expression1,string2,expression2 |
*expression1* should be an integer file
descriptor returned by the _CP_open call.

## Syntax

```
int _CP_writev(int type, CPSTR* string1, int expression1, CPSTR* string2,
expression2)
```

## Description

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

## Example(s)

```
/* Writes "hi" into attribute 1 of item "myid" in "myfile". */

CPSTR * s = _CP_mkstr("myfile");
CPSTR * t = _CP_mkstr("hi");
CPSTR * id = _CP_mkstr("myid");
int f;

_CP_open(&f,_CP_str_null,s);
_CP_writev(_CP_WRITE, t, f, id, 1);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_close](https://d3codex.com/cfunctions/cp-close/)
- [_CP_open](https://d3codex.com/cfunctions/cp-open/)
- [_CP_read](https://d3codex.com/cfunctions/cp-read/)
- [_CP_readv](https://d3codex.com/cfunctions/cp-readv/)
- [_CP_write](https://d3codex.com/cfunctions/cp-write/)

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