PCAP\_GETERR(3PCAP) PCAP\_GETERR(3PCAP)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

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

```
char *pcap_geterr(pcap_t *p);
void pcap_perror(pcap_t *p, const char *prefix);
```

# [DESCRIPTION](#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](#SEE_ALSO)

[**pcap**(3PCAP)](/man/os/libpcap/pcap.3PCAP), [**pcap\_strerror**(3PCAP)](/man/os/libpcap/pcap_strerror.3PCAP)

15 January 2016

---

Document: pcap_perror(3pcap) from libpcap 1.11.0-r0 (Chainguard OS)
Source: https://github.com/the-tcpdump-group/libpcap.git
