al_cstr(3alleg5)

al_cstr3alleg5

Allegro 5 api

Usage

#include <allegro5/allegro.h>
const char *al_cstr(const ALLEGRO_USTR *us)

Overview

Get a char * pointer to the data in a string. This pointer will only be valid while the ALLEGRO_USTR(3alleg5) object is not modified and not destroyed. The pointer may be passed to functions expecting C-style strings, with the following caveats:

•

ALLEGRO_USTRs are allowed to contain embedded NUL ('\0') bytes. That means al_ustr_size(u) and strlen(al_cstr(u)) may not agree.

•

An ALLEGRO_USTR may be created in such a way that it is not NUL terminated. A string which is dynamically allocated will always be NUL terminated, but a string which references the middle of another string or region of memory will not be NUL terminated.

•

If the ALLEGRO_USTR references another string, the returned C string will point into the referenced string. Again, no NUL terminator will be added to the referenced string.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From allegro5-doc 2:5.2.10.1+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.