---
name: "ts_error_fn"
section: "3"
platform: "linux"
package: "tslib"
version: "1.24-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ts_error_fn"
---

# ts\_error\_fn(3)

use a custom error function for libts library errors

## NAME

ts\_error\_fn - use a custom error function for libts library errors

## SYNOPSIS

```
#include <tslib.h>

int (*ts_error_fn)(const char *fmt, va_list ap);

```

## DESCRIPTION

**ts\_error\_fn**() is by default implemented similar like this:

```
static int errfn(const char *fmt, va_list ap)
{
        return vfprintf(stderr, fmt, ap);
}
```

inside the library. It is exposed to the user and can be replaced by a custom error function. Simply assign your custom implementation to **ts\_error\_fn** like

```
ts_error_fn = my_custom_errfn;
```

It can be used to write the system log files, for example. The ts\_print\_mt test program has an example.

## RETURN VALUE

user defined.

## SEE ALSO

[**ts\_read**(3)](/ts_read/3.md), [**ts\_open**(3)](/ts_open/3.md), [**ts\_setup**(3)](/ts_setup/3.md), [**ts\_close**(3)](/ts_close/3.md), [**ts.conf**(5)](/ts.conf/5.md)
