File: al_cstr.3

package info (click to toggle)
allegro5 2%3A5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,032 kB
  • sloc: ansic: 120,340; cpp: 15,707; objc: 4,805; python: 2,915; java: 2,195; sh: 887; xml: 86; makefile: 49; perl: 37; pascal: 24
file content (38 lines) | stat: -rw-r--r-- 1,167 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.TH "al_cstr" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
al_cstr \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

const\ char\ *al_cstr(const\ ALLEGRO_USTR\ *us)
\f[]
.fi
.SH DESCRIPTION
.PP
Get a \f[C]char\ *\f[] pointer to the data in a string.
This pointer will only be valid while the ALLEGRO_USTR(3) object is not
modified and not destroyed.
The pointer may be passed to functions expecting C\-style strings, with
the following caveats:
.IP \[bu] 2
ALLEGRO_USTRs are allowed to contain embedded NUL
(\f[C]\[aq]\\0\[aq]\f[]) bytes.
That means \f[C]al_ustr_size(u)\f[] and \f[C]strlen(al_cstr(u))\f[] may
not agree.
.IP \[bu] 2
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 \f[I]not\f[] be NUL terminated.
.IP \[bu] 2
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.
.SH SEE ALSO
.PP
al_ustr_to_buffer(3), al_cstr_dup(3)