Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/fceux.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqeed <qeed@users.sf.net>2010-10-01 23:27:12 +0400
committerqeed <qeed@users.sf.net>2010-10-01 23:27:12 +0400
commitfc1a10b2a4542f0c12a1d15333b76edabfb42b43 (patch)
tree905d9456962a720a967b825acafd26d0ed4097bb /src/emufile.h
parentb7b3319dfc6a1d23a804717c5dd25ed530555237 (diff)
fixed fp issue again, and then change vsprintf for something
Diffstat (limited to 'src/emufile.h')
-rw-r--r--src/emufile.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/emufile.h b/src/emufile.h
index 77ab466b..37b29631 100644
--- a/src/emufile.h
+++ b/src/emufile.h
@@ -132,13 +132,21 @@ public:
virtual int fprintf(const char *format, ...) {
va_list argptr;
va_start(argptr, format);
-
+
+ char *tempbuf = new char[size()];
+ int amt;
+ amt = vsnprintf(tempbuf, size(), format, argptr);
+
+ char *placeholder = new char[20];
+ placeholder[0] = 20;
//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);
- fwrite(tempbuf,amt);
+ vsprintf(tempbuf,format,argptr);*/
+
+ fwrite(tempbuf,amt);
delete[] tempbuf;
+ delete[] placeholder;
va_end(argptr);
return amt;
};