cfunc.str_copy C Function/C Functions


Command cfunc.str_copy C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description makes a copy of a CPSTR. The actual contents of the string are copied rather than just the pointer.
Syntax CPSTR * _CP_str_copy(CPSTR * string)
CPSTR * s = _CP_mkstr("Null value");
CPSTR * a[20];
int     i;

for (i = 0; i < 20; i++)
    a[i] = _CP_str_copy(s);

 This example assigns the string "Null value" to all the elements of 
the array "a".  Note that copies are necessary so that each element 
can be modified without affecting the others.
Related cfunc.introduction