int main(int argc, char *argv[]){ String s1; String s2; char *c1 = NULL; s1 = new_String("This "); s2 = new_String("is a test"); if(!String_appendString(s1, s2)){ fprintf(stderr, "String_appendString(): Uh oh!\n"); } else{ if(String_getChars(s1, &c1)){ printf("%s\n", c1); } else{ fprintf(stderr, "String_getChars(): Uh oh!\n"); } } delete_String(s1); delete_String(s2); return EXIT_SUCCESS; }
bool AttrList_deleteItem(AttrList l, String key){ bool retVal = true; bool found; bool identical; String s; size_t i; int idx = -1; idx = getIndex(l); if(idx >= 0){ found = false; for(i = 0; i < attrListPool[idx].size; ++i){ s = attrListPool[idx].keys[i]; if(s != INVALID_STRING){ if(String_equalsIgnoreCase(s, key, &identical)){ if(identical){ found = true; break; } } else{ break; } } } if(found){ delete_String(attrListPool[idx].keys[i]); attrListPool[idx].keys[i] = INVALID_STRING; attrListPool[idx].length--; retVal = true; } } return retVal; }
void testString ( testStruct const* obj ) { size_t size = 2048; String* st = new_String ( size, "" ); outStream* os = new_outStreamString ( st ); printf ( "\noutput to String\n" ); testStructEncode ( os, "myTestStruct", obj ); printf ( "%s\n", st -> chars ); delete_String ( st ); delete_outStream ( os ); }
void destroyGaugeQCDML(String *st){ delete_String ( st ); }