Modifying a WTSTRING value

The char* result of retrieving a WTSTRING property value is a pointer to the actual string stored in WTK.  DO NOT modify this directly with calls to WTfree, WTrealloc, strcat, strcpy, etc. If you need to modify the string value, make a local copy of the string before modifying it.

Example Using _gets functions:

char *value;
char *newvalue;
value = WTproperty_gets(object, "property_name");
newvalue = WTmalloc(strlen(value) + strlen("addtostring") + 1);
strcpy(newvalue, value);
strcat(newvalue, "addtostring");
WTproperty_sets(object, "property_name");
WTfree(newvalue);


Here is a utility function specifically to add to a string

FLAG WTproperty_addtostring(void* object, char *propname,  char *addthis);

FLAG WTproperty_addtostring(void* object, char *propname,  char *addthis)
{
        char *value;
char *newvalue;
value = WTproperty_sets(object, propname);
newvalue = WTmalloc(strlen(value) + strlen(addthis) + 1);
strcpy(newvalue, value);
strcat(newvalue, addthis);
WTproperty_sets(object, propname, newvalue);
WTfree newvalue;

}