---
name: "memcached_last_error_errno"
section: "3"
platform: "linux"
package: "libmemcached-awesome"
version: "1.1.4-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/memcached_last_error_errno"
---

# memcached\_last\_error\_errno(3)

libmemcached Documentation

## NAME

memcached\_last\_error\_errno - libmemcached Documentation

## SYNOPSIS

- **#include \<libmemcached/memcached.h\>**

  Compile and link with -lmemcached

- **memcached\_return\_t \<#\_CPPv418memcached\_return\_t\> memcached\_last\_error(const memcached\_st \<#\_CPPv412memcached\_st\> \*ptr)**

  - **Parameters**

    **ptr** -- pointer to an initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

  - **Returns**

    **memcached\_return\_t** \<#\_CPPv418memcached\_return\_t\> indicating success of last operation

- **const char \*memcached\_last\_error\_message(const memcached\_st \<#\_CPPv412memcached\_st\> \*ptr)**

  - **Parameters**

    **ptr** -- pointer to an initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

  - **Returns**

    message describing the status of last operation

- **int memcached\_last\_error\_errno(const memcached\_st \<#\_CPPv412memcached\_st\> \*ptr)**

  - **Parameters**

    **ptr** -- pointer to an initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

  - **Returns**

    **[errno(3)](/errno/3.md) \<https://linux.die.net/man/3/errno\>** (if any) of last operation

## DESCRIPTION

Retrieve error codes and messages.

## RETURN VALUE

**memcached\_last\_error()** returns the last error code.

**memcached\_last\_error\_message()** returns the last error message. If this error came from a specific server, its hostname and port will be provided in the error message. Any error message will be returned as 'const char \*' which does not need to be de-allocated. NULL will be returned if no error has occurred.

**memcached\_last\_error\_errno()** returns any last local error code obtained from **[errno(3)](/errno/3.md) \<https://linux.die.net/man/3/errno\>**.

## SEE ALSO

**[memcached(1)](/memcached/1.md) \<https://linux.die.net/man/1/memcached\>** **[errno(3)](/errno/3.md) \<https://linux.die.net/man/3/errno\>** **[libmemcached(3)](/libmemcached/3.md) \<https://linux.die.net/man/3/libmemcached\>** **[memcached\_strerror(3)](/memcached_strerror/3.md) \<https://linux.die.net/man/3/memcached\_strerror\>**
