Size: 688
Comment: update content (w/ Sam); remove 'draft' note
|
← Revision 16 as of 2016-05-11 20:22:50 ⇥
Size: 934
Comment: Changed wording of description.
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
Line 5: | Line 4: |
Use this function to set the SDL error string. | Use this function to set the SDL error message. |
Line 11: | Line 10: |
void SDL_SetError(const char* fmt, ...) |
int SDL_SetError(const char* fmt, ...) |
Line 14: | Line 13: |
== Function Parameters == ||'''fmt''' ||a printf() style message format string || ||'''...''' ||additional parameters matching % tokens in the '''fmt''' string, if any || |
|
Line 15: | Line 17: |
== Function Parameters == ||'''fmt'''||a printf() style message format string|| ||'''...'''||additional parameters matching % tokens in the '''fmt''' string, if any|| |
== Return Value == Returns always -1. |
Line 23: | Line 24: |
{{{#!highlight cpp int errorCode = 0; ... errorCode = -37; ... if (errorCode < 0) SDL_SetError("Something unexpected happened: Error Code %d", errorCode); }}} |
|
Line 25: | Line 33: |
''You can add useful comments here'' | Calling this function will replace any previous error message that was set. |
Line 28: | Line 36: |
.[[SDL_ClearError]] .[[SDL_GetError]] |
. [[SDL_ClearError]] . [[SDL_GetError]] |
Line 32: | Line 40: |
[[CategoryAPI]], [[CategoryError]] | [[CategoryAPI]], CategoryError |
SDL_SetError
Use this function to set the SDL error message.
Contents
Syntax
int SDL_SetError(const char* fmt,
...)
Function Parameters
fmt |
a printf() style message format string |
... |
additional parameters matching % tokens in the fmt string, if any |
Return Value
Returns always -1.
Code Examples
SDL_SetError("Something unexpected happened!");
int errorCode = 0;
...
errorCode = -37;
...
if (errorCode < 0)
SDL_SetError("Something unexpected happened: Error Code %d", errorCode);
Remarks
Calling this function will replace any previous error message that was set.