SDL_Error function
SDL_Error -- Sets the SDL error message to one of several predefined strings.
Syntax
void SDL_Error(SDL_errorcode code);
Description
Sets the SDL error message to the predefined string specified by code.
Parameter
code [in]
- The SDL error code to set
SDL_errorcode |
The corresponding error string |
SDL_ENOMEM |
Out of memory |
SDL_EFREAD |
Error reading from datastream |
SDL_EFWRITE |
Error writing to datastream |
SDL_EFSEEK |
Error seeking in datastream |
SDL_UNSUPPORTED |
Unknown SDL error |
SDL_LASTERROR |
Unknown SDL error |
any other value |
Unknown SDL error |
Note 1: SDL_LASTERROR marks the highest numbered predefined error.
Note 2: SDL also defines SDL_OutOfMemory() and SDL_Unsupported() for internal use, which are equivalent to SDL_Error(SDL_ENOMEM) and SDL_Error(SDL_UNSUPPORTED) respectively.
Return value
nothing
See Also
SDL_SetError, SDL_GetErrorMsg, SDL_GetError, SDL_ClearError
Example
1 // Try to allocate 1024 bytes
2 char* ptr = (char*) malloc(1024);
3
4 // Out of memory ?
5 if (!ptr) {
6 SDL_Error(SDL_ENOMEM);
7 return -1;
8 }
Requirements
Header |
SDL.h |
Version |
1.2.13 |
Shared object |
libSDL.so |
DLL |
SDL.dll |
