cfunc.saddr

C Macro/C Functions, Releases: AP 6.1

Return a pointer to the first character of a CPSTR*

Syntax

char* _CP_SADDR(CPSTR* string)

Description

returns a standard char* pointing to the first character of the string buffer within a CPSTR structure.

Because _CP_SADDR is a macro, it may be used either on the left-hand or the right-hand side of an assignment operator.

Example

CPSTR * s = _CP_mkstr('hi');
_CP_SADDR(s)[1] = 'o'; /* replace 2nd character */
_CP_unix_env(); /* Unix print environment */
_CP_TERM(s); /* null terminate */
printf('%s\n',_CP_SADDR(s));

See Also

Command Name Type Description
cfunc.introduction Introductory Overview
cfunc.slen C Macro Return the length of a CPSTR.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.