---
name: "explain_fclose_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_fclose_or_die"
---

# explain\_fclose\_or\_die(3)

close a stream and report errors

## NAME

explain\_fclose\_or\_die - close a stream and report errors

## SYNOPSIS

\#include \<libexplain/fclose.h\>\
 void explain\_fclose\_or\_die(FILE \*fp);

## DESCRIPTION

The explain\_fclose\_or\_die function is used to [*fflush*(3)](/fflush/3.md) and [*fclose*(3)](/fclose/3.md) the given stream.  If there is an error, it will be reported using [*explain\_fclose*(3)](/explain_fclose/3.md), and then terminates by calling `exit(EXIT_FAILURE)`.

```
explain_fclose_or_die(fp);
```

- *fp*

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

- Returns:

  Only returns on success. Reports error and process exits on failure.

## COPYRIGHT

libexplain version 1.4\
 Copyright (C) 2008 Peter Miller

## AUTHOR

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