SDL_strlen(3)

✨ NAME ✨

SDL_strlen β€” bestie, this is literally strlen() but it does NOT need access to a C runtime πŸ’–

It's part of the SDL3 functions, so if you're out here reading the SDL_strlen(3) page, you're in the right place 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

size_t SDL_strlen(const char *str);

πŸ’… DESCRIPTION πŸ’…

Okay so what does it actually do? It counts the bytes in str, and it does not count the null terminator. That's it. That's the whole job. Iconic behaviour, no notes πŸ‘‘

Heads up though: if what you actually need is the length of a UTF-8 string, the docs say consider using SDL_utf8strlen() instead. Not the same thing, bestie, bytes β‰  characters, don't get caught out 😭

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • str β€” the null-terminated string you want to read. It must not be NULL. Fr fr, do not pass NULL, that's not the vibe πŸ™ˆ

πŸ¦‹ RETURN VALUE πŸ¦‹

It returns the length β€” in bytes, excluding the null terminator β€” of src.

(yes, the docs say src even though the parameter is called str, we don't ask questions, we just report what's on the page πŸ’€)


🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. So go ahead and spam it from every thread you've got, she's unbothered πŸ’œ


⭐ AVAILABILITY ⭐

This function has been available since SDL 3.2.0.


πŸ‘‘ SEE ALSO πŸ‘‘


And that's the whole page, bestie, you ate it πŸ“βœ¨ This lil love letter to string counting comes to you from Simple Directmedia Layer, living its SDL 3.4.18 era, and it's the SDL_strlen(3) page through and through πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from