#include #include #include "str.h" void clearStr(struct Str *str) { *(str->end = str->cstr) = 0; } void appendCharToStr(struct Str *str, char c) { // check if another character and 0 byte fits into string if (str->end - str->cstr + 2 > sizeof(str->cstr)) { fprintf(stderr, "error in appendCharToStr: string too long\n"); exit(1); } *str->end++ = c; *str->end = 0; }