---
name: "freefare_error"
section: "3"
platform: "linux"
package: "libfreefare-doc"
version: "0.4.0-2.3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/freefare_error"
---

# freefare\_error(3)

Error Reporting Functions.

## NAME

**freefare\_strerror**, **freefare\_strerror\_r**, **freefare\_perror**, **mifare\_desfire\_last\_picc\_error** – Error Reporting Functions.

## LIBRARY

Mifare card manipulation library (libfreefare, -lfreefare)

## SYNOPSIS

**#include \<freefare.h\>**

*const char \**\

**freefare\_strerror**(*MifareTag tag*);

*int*\

**freefare\_strerror\_r**(*MifareTag tag*, *char \*buffer*, *size\_t len*);

*void*\

**freefare\_strerror**(*MifareTag tag*, *char \*string*);

*uint8\_t*\

**mifare\_desfire\_last\_pcd\_error**(*MifareTag tag*);

*uint8\_t*\

**mifare\_desfire\_last\_picc\_error**(*MifareTag tag*);

## DESCRIPTION

The **freefare\_strerror**() functions returns the error string corresponding to the last PCD or PICC error encounred using *tag*.

The **freefare\_strerror\_r**() functions does the same as **freefare\_strerror**() but the error message is copied into *buffer* for a maximum size of *len* chars.

The **freefare\_strerror**() function displays the last PCD or PICC error encounred using *tag* to stderr.

The **mifare\_desfire\_last\_pcd\_error**() function returns the error code of the last function call from the library.

The **mifare\_desfire\_last\_picc\_error**() function returns the error code returned by the last command run on *tag*.

## RETURN VALUES

**freefare\_strerror**() returns the error message, **freefare\_strerror\_r**() returns 0 on success, -1 on failure; **mifare\_desfire\_last\_pcd\_error**() and **mifare\_desfire\_last\_picc\_error**() return an error code or 0 if no error occured or if *tag* is not a Mifare DESFire target.

## SEE ALSO

[freefare(3)](/freefare/3.md),

## AUTHORS

Romain Tartiere ⟨romain@il4p.org⟩
