---
name: "pcap_close"
section: "3pcap"
platform: "linux"
package: "libpcap"
version: "1.11.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_close/3pcap"
---

# pcap\_close(3pcap)

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**(3PCAP), **pcap\_open\_offline**(3PCAP)
