I'm using the SDL library in my project and I'm working on a Windows platform.
When I'd decided to move my project to SDL 2, I encountered a problem:
There was an option in SDL 1.2 to print output from stdout/stderr into the console window, rather than to files by defining a NO_STDIO_REDIRECT
macro. However, I haven't found that macro in SDL 2.
Is there a way to print SDL 2 output to the console instead of the standard files?
I suspect that NO_STDIO_REDIRECT
is no longer part of SDL2.
You should use instead SDL_Log
and all the other related functions to log messages from within your application.
Then you can use SDL_LogSetOutputFunction
to:
replace the default log output function with one of your own
Note that you can gracefully handle any given category or priority, being the prototype of the handler the one below:
void SDL_LogOutputFunction(void* userdata,
int category,
SDL_LogPriority priority,
const char* message)
Please, refer to the linked documentation for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With