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() and pipe_stdio was set to true, or
  • it was made with SDL_CreateProcessWithProperties() and SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER was set to SDL_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