|
Size: 632
Comment: create page, add content (Wed Mar 10 ver; changeset 4428)
|
Size: 1160
Comment: add 'draft' note
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 6: | Line 6: |
| Use this function to ^get more information about an error^. | Use this function to retrieve a message about the last error that occurred. |
| Line 16: | Line 16: |
| A pointer to (a enum? filled with) information about the specific error that occurred. | Returns a message with information about the specific error that occurred, or an empty string if there hasn't been an error since the last call to [[SDL_ClearError]](). *<<BR>>This string is statically allocated and must not be freed by the user. <<BR>>* |
| Line 20: | Line 22: |
| You can add your code example here | if (SDL_Init( SDL_INIT_EVERYTHING ) == -1) { // Unrecoverable error, exit here. printf("SDL_Init failed: %s\n", SDL_GetError()); } |
| Line 22: | Line 27: |
| *<<BR>>Note: Although this example uses [[SDL_Init]](), [[SDL_GetError]]() provides an error message for any failed SDL operation. <<BR>>* | |
| Line 24: | Line 30: |
| ''You can add useful comments here'' | It is possible for multiple errors to occur before calling [[SDL_GetError]](). Only the last error is returned. |
| Line 27: | Line 33: |
| .[[SDL_ClearError]] ??? | .[[SDL_ClearError]] .[[SDL_SetError]] * |
DRAFT |
SDL_GetError
Use this function to retrieve a message about the last error that occurred.
Syntax
char* SDL_GetError(void)
Return Value
Returns a message with information about the specific error that occurred, or an empty string if there hasn't been an error since the last call to SDL_ClearError().
*
This string is statically allocated and must not be freed by the user.
*
Code Examples
if (SDL_Init( SDL_INIT_EVERYTHING ) == -1) {
// Unrecoverable error, exit here.
printf("SDL_Init failed: %s\n", SDL_GetError());
}
*
Note: Although this example uses SDL_Init(), SDL_GetError() provides an error message for any failed SDL operation.
*
Remarks
It is possible for multiple errors to occur before calling SDL_GetError(). Only the last error is returned.
