---
name: "explain_fchdir_or_die"
section: "3"
platform: "linux"
package: "libexplain-dev"
version: "1.4.D001-16"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/explain_fchdir_or_die"
---

# explain\_fchdir\_or\_die(3)

change directory and report errors

## NAME

explain\_fchdir\_or\_die - change directory and report errors

## SYNOPSIS

\#include \<libexplian/fchdir.h\>\
 void explain\_fchdir\_or\_die(int fildes);\

## DESCRIPTION

The explain\_fchdir\_or\_die function is used to change directory via the [*fchdir*(2)](/fchdir/2.md) system call. On failure, it prints an error message on stderr via [*explain\_fchdir*(3)](/explain_fchdir/3.md), and exits.

This function is intended to be used in a fashion similar to the following example:

```
explain_fchdir_or_die(fildes);
```

- *fildes*

  exactly as to be passed to the [*fchdir*(2)](/fchdir/2.md) system call.

## SEE ALSO

- *fchdir*(3)

  change working directory

- [*explain\_fchdir*(3)](/explain_fchdir/3.md)

  report [*fchdir*(2)](/fchdir/2.md) errors

- [*exit*(2)](/exit/2.md)

  terminate the calling process

## COPYRIGHT

libexplain version 1.4\
 Copyright (C) 2008 Peter Miller

## AUTHOR

Written by Peter Miller \<pmiller@opensource.org.au\>
