Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum error_code append_string(struct string *str, char *buf)
- {
- size_t i;
- size_t it = 0;
- size_t bufSize = strlen(buf);
- while (str->capacity <= (bufSize + str->size))
- str->capacity *= sizeModifier;
- str->buffer = (char *)realloc(str->buffer, sizeof(char) * str->capacity);
- for (i = str->size; i < (str->size + bufSize); i++)
- str->buffer[i] = buf[it++];
- str->buffer[i++] = '\0';
- str->size = strlen(str->buffer);
- return OK;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement