# %chdir() function

The %chdir() function changes the current
directory to the one specified in str.

## Syntax

```
var = %chdir(str)
```

## Description

A -1 returned from this function
indicates an error condition.

## Example(s)

```
if %chdir(’/usr/pick’) = -1 then crt ’errno=’:system(0)
```
If an error occurs, the error message displays from system(0) function.

## See also

- [FlashBASIC C functions overview](https://d3codex.com/pickbasic-flashbasic/flashbasic-c-functions-overview/)
- [cd command](https://d3codex.com/tcl/cd-command/)
- [cfunction statement](https://d3codex.com/pickbasic-flashbasic/cfunction-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/percent-chdir-function/ - part of the D3Codex reference.
