port an emufile fix from fceux

This commit is contained in:
zeromus 2010-10-02 01:48:56 +00:00
parent 15ac34c397
commit 414d661205
1 changed files with 9 additions and 4 deletions

View File

@ -138,9 +138,14 @@ public:
//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];
va_end(argptr);
va_start(argptr, format);
vsprintf(tempbuf,format,argptr); vsprintf(tempbuf,format,argptr);
fwrite(tempbuf,amt); fwrite(tempbuf,amt);
delete[] tempbuf; delete[] tempbuf;
va_end(argptr); va_end(argptr);
return amt; return amt;
}; };