try restarting varargs

This commit is contained in:
zeromus 2010-10-01 20:09:18 +00:00
parent dfd7c63782
commit 795de75419
1 changed files with 5 additions and 8 deletions

View File

@ -133,16 +133,13 @@ public:
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);
char *tempbuf = new char[size()];
int amt;
amt = vsnprintf(tempbuf, size(), format, argptr);
// this crashes for some reason
//we dont generate straight into the buffer because it will null terminate (one more byte than we want) //we dont generate straight into the buffer because it will null terminate (one more byte than we want)
/*int amt = vsnprintf(0,0,format,argptr); int amt = vsnprintf(0,0,format,argptr);
char* tempbuf = new char[amt+1]; char* tempbuf = new char[amt+1];
vsprintf(tempbuf,format,argptr);*/
va_end(argptr);
va_start(argptr, format);
vsprintf(tempbuf,format,argptr);
fwrite(tempbuf,amt); fwrite(tempbuf,amt);
delete[] tempbuf; delete[] tempbuf;