---
name: "pcap_geterr"
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_geterr"
---

# pcap\_geterr(3)

get or print libpcap error message text

## NAME

pcap\_geterr, pcap\_perror - get or print libpcap error message text

## SYNOPSIS

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

**char \*pcap\_geterr(pcap\_t \*p);** **void pcap\_perror(pcap\_t \*p, const char \*prefix);**

## DESCRIPTION

**pcap\_geterr**() returns the error text pertaining to the last pcap library error. **NOTE**: the pointer it returns will no longer point to a valid error message string after the **pcap\_t** passed to it is closed; you must use or copy the string before closing the **pcap\_t**.

**pcap\_perror**() prints the text of the last pcap library error on **stderr**, prefixed by *prefix*.

## SEE ALSO

[**pcap**(3)](/pcap/3.md)
