---
name: "explain_freopen_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_freopen_or_die"
---

# explain\_freopen\_or\_die(3)

open file and report errors

## NAME

explain\_freopen\_or\_die - open file and report errors

## SYNOPSIS

\#include \<libexplain/freopen.h\>\
 void explain\_freopen\_or\_die(const char \*pathname, const char \*flags, FILE \*fp);

## DESCRIPTION

The explain\_freopen\_or\_die function is used to reopen a file via the [*freopen*(3)](/freopen/3.md) system call.  On failure it will print an explanation, obtained from the *linexplain\_freopen*(3) function, on the standard error stream and then exit.

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

```
explain_freopen_or_die(pathname, flags, fp);
```

- *pathname*

  The pathname, exactly as to be passed to the [*freopen*(3)](/freopen/3.md) system call.

- *flags*

  The flags, exactly as to be passed to the [*freopen*(3)](/freopen/3.md) system call.

- *fp*

  The fp, exactly as to be passed to the [*freopen*(3)](/freopen/3.md) system call.

- Returns:

  Only ever return on success. Never returns on failure.

## COPYRIGHT

libexplain version 1.4\
 Copyright (C) 2008 Peter Miller

## AUTHOR

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