al_get_clipboard_text(3alleg5)
β¨ NAME β¨
al_get_clipboard_text β the Allegro 5 API function that goes and grabs whatever text the clipboard is holding for you, bestie π
πΈ SYNOPSIS πΈ
#include <allegro5/allegro.h>
char *al_get_clipboard_text(ALLEGRO_DISPLAY *display)
π DESCRIPTION π
Okay so picture this: the clipboard has text, and you want it. That's literally the whole plot. This function returns a pointer to a string, and that string was allocated with al_malloc(3alleg5), and it contains the text contents of the clipboard β if available. That "if available" is doing a lot of work, so listen up.
If there's no text available on the clipboard, then this function returns NULL. No text, no pointer, no drama, that's it. π
And the part everyone forgets: you must call al_free(3alleg5) on the returned pointer when you don't need it anymore. The memory is yours now, babes, nobody's gonna clean it up for you. Free your stuff. It's giving responsible main character energy π
β οΈ Beware bestie, for real: text on the clipboard on Windows may be in Windows format. That means it may have carriage return newline combinations for the line endings instead of regular newlines for the line endings on Linux or OSX. So if your line endings look cursed, that's why. Not you. Windows. π
π¦ SINCE π¦
5.1.12 β she's been here since 5.1.12 and she's been slaying ever since β¨
π SEE ALSO π
al_set_clipboard_text(3alleg5)β the reverse vibe, putting text onto the clipboard π«Άal_clipboard_has_text(3alleg5)β the vibe check, to see if there's anything there before you go grabbing π
And that's the page, bestie! This was the Allegro reference manual's al_get_clipboard_text(3alleg5) entry. Go forth, grab that clipboard text, free that pointer, and remember: carriage returns are a Windows thing and they're not your fault. Periodt. πβ
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms