Well, I went through and changed all my sprintf's to snprintf's, and have come across a small problem with this line:Now, when its the sprintf version It doesn't like it, and cuts off a good portion of it. Now, I know the problem is with copying buf back into itself, but there has to be a way around it other than this: Can anyone explain it?
sprintf(buf, "%s%s%s", buf, buf[0] == '\0' ? "" : " ", arg); snprintf(buf, MSL, "%s%s%s", buf, buf[0] == '\0' ? "" : " ", arg); {
char tmp_buf[MSL]; // Crappy hack fix
strcpy(tmp_buf, buf);
snprintf(buf, MSL, "%s%s%s", tmp_buf, tmp_buf[0] == '\0' ? "" : " ", arg);
}