SDL_GetClipboardData(3)
π SDL_GetClipboardData(3) π
okay bestie, so this one lives in the SDL3 FUNCTIONS part of the manual, and it's literally your backstage pass to whatever the clipboard is holding rn. Let's get into it β¨
πΈ NAME πΈ
SDL_GetClipboardData β grab the data sitting on the clipboard for a mime type you pick π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_clipboard.h>
void * SDL_GetClipboardData(const char *mime_type, size_t *size);
β¨ DESCRIPTION β¨
So like, the size of text data does not include the terminator, but the text is guaranteed to be null-terminated. Both things are true at once, she contains multitudes π
π FUNCTION PARAMETERS π
mime_typeβ the mime type you wanna read off the clipboard. pick your fighter π«Άsizeβ a pointer that gets filled in with the length of the returned data. she's an out-param, she's doing her job π
π₯ RETURN VALUE π₯
Returns the retrieved data buffer, or NULL on failure π β in that case call SDL_GetError() for more info, she'll tell you what went wrong.
β οΈ no cap: you must free that buffer with SDL_free() once you're done with it. don't just leave it sitting there, that's not main character energy, that's a leak π
π THREAD SAFETY π
This function should only be called on the main thread. do not be texting the clipboard from a side thread bestie, she will not answer π
π AVAILABILITY π
This function is available since SDL 3.2.0. vintage but make it fresh β¨
π«Ά SEE ALSO π«Ά
iykyk, go read those next, they're the whole friend group π
mwah okay that's the whole page!! brought to you by the fine folks at Simple Directmedia Layer, from SDL 3.4.18, and yes this specific page is SDL_GetClipboardData(3) π¦ go get that clipboard data queen π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms