From 795de7541996e000711daef40c120e5adb72ae5a Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 1 Oct 2010 20:09:18 +0000 Subject: [PATCH] try restarting varargs --- src/emufile.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/emufile.h b/src/emufile.h index a943e99d..cbe793ed 100644 --- a/src/emufile.h +++ b/src/emufile.h @@ -133,16 +133,13 @@ public: va_list argptr; 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) - /*int amt = vsnprintf(0,0,format,argptr); + int amt = vsnprintf(0,0,format,argptr); char* tempbuf = new char[amt+1]; - vsprintf(tempbuf,format,argptr);*/ + + va_end(argptr); + va_start(argptr, format); + vsprintf(tempbuf,format,argptr); fwrite(tempbuf,amt); delete[] tempbuf;