SDL_vasprintf(3)

πŸ’– SDL_vasprintf β€” bestie edition πŸ’–

okay so this is SDL_vasprintf, a lil function from the SDL3 functions crew (that's the manual it lives in, and yes it's a whole vibe). It does exactly what vasprintf() does, except it doesn't need access to a C runtime. no cap. that's the whole point. 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

int SDL_vasprintf(char **strp, const char *fmt, va_list ap);

🌸 DESCRIPTION 🌸

It functions identically to SDL_asprintf(), with one lil twist: instead of taking ... variable arguments, it takes a va_list. that's it. that's the plot. πŸ’…


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • strp β€” on output, this gets set to the new string. must NOT be NULL. do not test her like that. πŸ™ˆ
  • fmt β€” a printf-style format string. also must NOT be NULL. πŸ“
  • ap β€” a va_list of values to be used with the format string. it's giving "here's the receipts, format them". ✨

⭐ RETURN VALUE ⭐

Returns the number of bytes in the newly-allocated string β€” and not counting the null-terminator char, bestie, don't forget that part β€” or a negative value on error. so if you get a negative number back, that's your vibe check failing. 😭


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. go off, multithreaded queen. πŸ‘‘


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. if you're on something older... babe. upgrade. πŸ’œ


mwah πŸ’– that's the whole page. this one came to you courtesy of Simple Directmedia Layer, running SDL 3.4.18 β€” and yeah, SDL_vasprintf(3) is the page name, in case you needed to cite her. periodt. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from