Obtain pointer into string object¶
ss_string_ptr
is a function defined in ssstring.c.
Synopsis:
-
const char *
ss_string_ptr
(const ss_string_t *str)¶
Description: This function is similar to ss_string_get except rather than copying the string to some other memory it
returns a pointer directly into the ss_string_t
object. The caller should expect that the pointer is valid
only until some other operation on that object.
Return Value: On success, returns a temporary pointer directly into the str
object. If the value is zero bytes long then a
pointer to a NUL
character is returned instead of null.
Parallel Notes: Independent
Issues: The returned value is `const’ because if it points into the Strings array then it might be the case that multiple strings currently having the same value are sharing the same storage.
See Also:
- ss_string_get: 9.1: Get a C string from a persistent string
- Strings: Introduction for current chapter