Hello, I’m trying to handle errors using SDL2 and I’m getting some garbled text here when an error is caught and I try to print it. I’m sure there’s something simple I’m doing wrong, but I’m not super familiar with handling something like this.
using SimpleDirectMediaLayer
font = SimpleDirectMediaLayer.TTF_OpenFont("F:\\Projects\\Julia\\julGame\\src\\editor\\Editor\\src\\..\\Fonts\\Round9x13.ttf", 12)
if font == C_NULL
println(unsafe_string(SimpleDirectMediaLayer.SDL_GetError()))
end
The error I get is:
Couldn’t open F:\Projects\Julia\julGame\s
If I extend the string length to 84 (which should be the length of the entire error) it looks like this:
F:\Projects\Julia\julGame\s�������♣����������▲�����▲����☺�������`�M5
The error itself is not an issue. I can fix it. But I would like to be able to see the entire thing when I catch it. Does anyone know what I’m doing wrong here? Thank you.
FYI, the SDL_GetError
function looks like this:
function SDL_GetError()
ccall((:SDL_GetError, libsdl2), Ptr{Cchar}, ())
end