1allegro_error(3) Allegro manual allegro_error(3)
2
3
4
6 allegro_error - Stores the last Allegro error message.
7
9 #include <allegro.h>
10
11
12 extern char allegro_error[ALLEGRO_ERROR_SIZE];
13
15 Text string used by set_gfx_mode(), install_sound() and other functions
16 to report error messages. If they fail and you want to tell the user
17 why, this is the place to look for a description of the problem. Exam‐
18 ple:
19
20 void abort_on_error(const char *message)
21 {
22 if (screen != NULL)
23 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
24
25 allegro_message("%s.\nLast Allegro error `%s'\n",
26 message, allegro_error);
27 exit(-1);
28 }
29 ...
30 if (some_allegro_function() == ERROR_CODE)
31 abort_on_error("Error calling some function!");
32
34 set_gfx_mode(3), install_sound(3)
35
36
37
38Allegro version 4.2.3 allegro_error(3)