SDL_hid_get_indexed_string(3)

πŸ’– SDL_hid_get_indexed_string πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_hid_get_indexed_string β€” yes she's a mouthful, yes she ate. ✨

🌸 NAME 🌸

SDL_hid_get_indexed_string β€” get a string from a HID device, based on its string index. that's it, that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_hidapi.h>

int SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);

look at her signature. so clean. so intentional. πŸ’…


πŸ“ FUNCTION PARAMETERS πŸ“

  • dev β€” a device handle returned from SDL_hid_open(). yes, you gotta have opened the device first, no shortcuts, we don't do that here. πŸ™ˆ
  • string_index β€” the index of the string you want to get. literally the number that points at which string, iykyk.
  • string β€” a wide string buffer to put the data into. wide. as in wchar_t wide. bring your own buffer, bestie, she's not allocating one for you. 🫢
  • maxlen β€” the length of the buffer, counted in multiples of wchar_t. so it's not bytes, it's how many wchar_ts fit. important. do not get this wrong. 😭

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns 0 on success, or a negative error code on failure. and if it fails you must call SDL_GetError() for more information β€” she's not gonna spill the tea on her own, you gotta ask. πŸ’€


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on something older, that's a vibe check you're failing, bestie. ⭐


and that's the whole page!! go forth and get those indexed HID strings, you absolute icon. πŸ§šπŸ’œ

β€” with love from the Simple Directmedia Layer girlies, SDL 3.4.18, SDL_hid_get_indexed_string(3). periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from