My Project
|
Go to the source code of this file.
Functions | |
DECLSPEC int SDLCALL | SDL_SetError (SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1) |
DECLSPEC const char *SDLCALL | SDL_GetError (void) |
DECLSPEC char *SDLCALL | SDL_GetErrorMsg (char *errstr, int maxlen) |
DECLSPEC void SDLCALL | SDL_ClearError (void) |
Internal error functions | |
#define | SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) |
#define | SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) |
#define | SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) |
enum | SDL_errorcode { SDL_ENOMEM , SDL_EFREAD , SDL_EFWRITE , SDL_EFSEEK , SDL_UNSUPPORTED , SDL_LASTERROR } |
DECLSPEC int SDLCALL | SDL_Error (SDL_errorcode code) |
Simple error message routines for SDL.
DECLSPEC void SDLCALL SDL_ClearError | ( | void | ) |
Clear any previous error message for this thread.
DECLSPEC const char *SDLCALL SDL_GetError | ( | void | ) |
Retrieve a message about the last error that occurred on the current thread.
It is possible for multiple errors to occur before calling SDL_GetError(). Only the last error is returned.
The message is only applicable when an SDL function has signaled an error. You must check the return values of SDL function calls to determine when to appropriately call SDL_GetError(). You should not use the results of SDL_GetError() to decide if an error has occurred! Sometimes SDL will set an error string even when reporting success.
SDL will not clear the error string for successful API calls. You must check return values for failure cases before you can assume the error string applies.
Error strings are set per-thread, so an error set in a different thread will not interfere with the current thread's operation.
The returned string is internally allocated and must not be freed by the application.
DECLSPEC char *SDLCALL SDL_GetErrorMsg | ( | char * | errstr, |
int | maxlen | ||
) |
Get the last error message that was set for the current thread.
This allows the caller to copy the error string into a provided buffer, but otherwise operates exactly the same as SDL_GetError().
errstr | A buffer to fill with the last error message that was set for the current thread |
maxlen | The size of the buffer pointed to by the errstr parameter |
errstr
parameter.DECLSPEC int SDLCALL SDL_SetError | ( | SDL_PRINTF_FORMAT_STRING const char * | fmt, |
... | |||
) |
Set the SDL error message for the current thread.
Calling this function will replace any previous error message that was set.
This function always returns -1, since SDL frequently uses -1 to signify an failing result, leading to this idiom:
fmt | a printf()-style message format string |
... | additional parameters matching % tokens in the fmt string, if any |