1al_cstr(3) al_cstr(3)
2
3
4
6 al_cstr - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 const char *al_cstr(const ALLEGRO_USTR *us)
12
14 Get a char * pointer to the data in a string. This pointer will only
15 be valid while the ALLEGRO_USTR(3) object is not modified and not
16 destroyed. The pointer may be passed to functions expecting C-style
17 strings, with the following caveats:
18
19 · ALLEGRO_USTRs are allowed to contain embedded NUL ('\0') bytes. That
20 means al_ustr_size(u) and strlen(al_cstr(u)) may not agree.
21
22 · An ALLEGRO_USTR may be created in such a way that it is not NUL ter‐
23 minated. A string which is dynamically allocated will always be NUL
24 terminated, but a string which references the middle of another
25 string or region of memory will not be NUL terminated.
26
27 · If the ALLEGRO_USTR references another string, the returned C string
28 will point into the referenced string. Again, no NUL terminator will
29 be added to the referenced string.
30
32 al_ustr_to_buffer(3), al_cstr_dup(3)
33
34
35
36Allegro reference manual al_cstr(3)