fixed fp issue again, and then change vsprintf for something
This commit is contained in:
parent
b7b3319dfc
commit
fc1a10b2a4
|
@ -133,12 +133,20 @@ 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);
|
||||||
|
|
||||||
|
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)
|
//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);
|
vsprintf(tempbuf,format,argptr);*/
|
||||||
|
|
||||||
fwrite(tempbuf,amt);
|
fwrite(tempbuf,amt);
|
||||||
delete[] tempbuf;
|
delete[] tempbuf;
|
||||||
|
delete[] placeholder;
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
return amt;
|
return amt;
|
||||||
};
|
};
|
||||||
|
|
|
@ -474,7 +474,7 @@ void FCEUSS_Save(const char *fname)
|
||||||
st = FCEUD_UTF8_fstream(fn,"wb");
|
st = FCEUD_UTF8_fstream(fn,"wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st == NULL)
|
if(st == NULL || st->get_fp() == NULL)
|
||||||
{
|
{
|
||||||
FCEU_DispMessage("State %d save error.",0,CurrentState);
|
FCEU_DispMessage("State %d save error.",0,CurrentState);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue