I\'m building a string piece by piece in my program and am currently using a mix of strcat() when I\'m adding a simple string onto the end, but when im adding a formatted string
Everything can be more simpler
void strfcat(char *src, char *fmt, ...) { char buf[2048]; va_list args; va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); strcat(src, buf); }
Use it like strcat().
strfcat(dst, "%d:%s:%c\n", 4,"bla",'c'); strfcat(dst, "%d:%d:%c\n", 4,13,'s');