# writevu statement

The writevu form of this statement is identical to
 writev, except that it keeps items locked that were locked by a previous
 readu or readvu statement.

## Syntax

```
writevu exp ON {file.var,} ID.exp, ac.exp
```

## Parameter(s)

| exp | Expression to write to the specified file. |
| --- | --- |
| file.var | File to write to. Contains the item expressed in ID.exp. If omitted, the default file variable is used. |
| ID.exp | Item to write to. Contains the attribute expressed in ac.exp. |
| ac.exp | Attribute to write to. |

## Description

`-1` can be used
as the value of the attribute count expression. This appends a new
attribute to the end of the item.

writevu requires that the entire item be read into temporary workspace so
that it can be rebuilt with the new attribute value, before it is
written back to the file.

A series of writevu statements addressing different attributes in the same item can
get very slow because the item has to be reread for every writevu.

A further problem with writevu is that it is not atomic. A writevu, although
faster, is equivalent to this fragment of BASIC code:

```
xx<attr> = str
writeu xxon file, item
```

## Example(s)

```
writevu time() on control.file,’control.list’,3
```

## See also

- [Attribute count expression](https://d3codex.com/pickbasic-flashbasic/attribute-count-expression/)
- [Default File Variables](https://d3codex.com/pickbasic-flashbasic/default-file-variables/)
- [File variable](https://d3codex.com/pickbasic-flashbasic/file-variable/)
- [ID expression](https://d3codex.com/pickbasic-flashbasic/id-expression/)
- [matread statement](https://d3codex.com/pickbasic-flashbasic/matread-statement/)
- [readv statement](https://d3codex.com/pickbasic-flashbasic/readv-statement/)
- [release statement](https://d3codex.com/pickbasic-flashbasic/release-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [writev statement](https://d3codex.com/pickbasic-flashbasic/writev-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/writevu-statement/ - part of the D3Codex reference.
