/*********************************************************** * 功能: 追加单个字符到动态字符串对象 * pstr: 动态字符串指针 * ch: 所要追加的字符 **********************************************************/ void dynstring_chcat(DynString *pstr, int ch) { int count; count = pstr->count + 1; if (count > pstr->capacity) dynstring_realloc(pstr, count); ((char *)pstr->data)[count - 1] = ch; pstr->count = count; }
void dynstring_chcat(DynString* ptr, char ch) //追加单个字符到动态字符串 { int count; count = ptr->count + 1; if (count > ptr->capacity) dynstring_realloc(ptr, count); ((char *)ptr->data)[count - 1] = ch; ptr->count = count; }