---
name: "SDL_GetGamepadFromID"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GetGamepadFromID"
---

# SDL\_GetGamepadFromID(3)

Get the SDL\_Gamepad associated with a joystick instance ID, if it has been opened.

## NAME

SDL\_GetGamepadFromID - Get the  **SDL\_Gamepad**\
  associated with a joystick instance ID, if it has been opened.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Gamepad \* SDL\_GetGamepadFromID(SDL\_JoystickID instance\_id);**

## FUNCTION PARAMETERS

- *instance\_id*

  the joystick instance ID of the gamepad.

## RETURN VALUE

( **SDL\_Gamepad**\
  \*) Returns an  **SDL\_Gamepad**\
  on success or NULL on failure or if it hasn't been opened yet; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.
