---
name: "pcap_close"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pcap_close"
---

# pcap\_close(3)

close a capture device or savefile

## NAME

pcap\_close - close a capture device or savefile

## SYNOPSIS

```
#include <pcap/pcap.h>
```

**void pcap\_close(pcap\_t \*p);**

## DESCRIPTION

**pcap\_close**() closes the files associated with *p* and deallocates resources. This means that, for example, if *p* refers to a savefile that was opened with **pcap\_fopen\_offline**() or **pcap\_fopen\_offline\_with\_tstamp\_precision**(), the stream provided to the routine will be closed unless it is **stdin**.

## SEE ALSO

[**pcap**(3)](/pcap/3.md), [**pcap\_open\_offline**(3)](/pcap_open_offline/3.md)
