SDL_GetProcessOutput(3)
π SDL_GetProcessOutput(3) π
okay bestie so this is a page from the SDL3 FUNCTIONS manual and we're about to get so cozy with SDL_GetProcessOutput. pull up a chair, grab a strawberry π, and let's get into it.
β¨ NAME β¨
SDL_GetProcessOutput β grab the SDL_IOStream that's hooked up to a process's standard output. yes, the stdout. that one. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_process.h>
SDL_IOStream * SDL_GetProcessOutput(SDL_Process *process);
π¦ DESCRIPTION π¦
okay so here's the vibe check: the process you're passing in has to have been created the right way, or this whole thing is giving nothing. specifically:
- it was made with
SDL_CreateProcess()andpipe_stdiowas set totrue, or - it was made with
SDL_CreateProcessWithProperties()andSDL_PROP_PROCESS_CREATE_STDOUT_NUMBERwas set toSDL_PROCESS_STDIO_APP.
that's the whole deal. no shortcuts, no cap. π
now, real talk: reading from this stream can return 0, with SDL_GetIOStatus() returning SDL_IO_STATUS_NOT_READY β that just means there's no output available yet. it's not a failure, bestie, it's just not ready. don't panic. π
π FUNCTION PARAMETERS π
processβ the process you wanna get the output stream for. that's it, that's the argument. π«Ά
β RETURN VALUE β
it hands you back the output stream β slay. π
and if it fails? you get NULL. on failure, call SDL_GetError() for more information, because the error message is literally right there waiting for you and it's not gonna read itself.
π₯ THREAD SAFETY π₯
it is safe to call this function from any thread. main character energy, no matter which thread you're on. π
π AVAILABILITY π
this function has been available since SDL 3.2.0. iconic behavior, honestly.
π SEE ALSO π
and that's the whole page, bestie! π§ this was the Simple Directmedia Layer manual, SDL 3.4.18 era β go forth and pipe those stdouts responsibly, ily, bye πβ¨
π¦ 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