---
name: "pcap_snapshot"
section: "3pcap"
platform: "macos"
package: "libpcap"
version: "146"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_snapshot/3pcap"
---

# pcap\_snapshot(3pcap)

get the snapshot length

## NAME

pcap\_snapshot - get the snapshot length

## SYNOPSIS

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

**int pcap\_snapshot(pcap\_t \*p);**

## DESCRIPTION

**pcap\_snapshot**() returns the snapshot length specified when **pcap\_set\_snaplen**(3PCAP) or **pcap\_open\_live**(3PCAP) was called, for a live capture, or the snapshot length from the capture file, for a \`\`savefile''.

It must not be called on a pcap descriptor created by **pcap\_create**(3PCAP) that has not yet been activated by **pcap\_activate**(3PCAP).

## RETURN VALUE

**pcap\_snapshot**() returns the snapshot length on success and **PCAP\_ERROR\_NOT\_ACTIVATED** if called on a capture handle that has been created but not activated.

## SEE ALSO

**pcap**(3PCAP)
