GP32 Sprintf


Charge

Member
Joined
May 26, 2003
Messages
206
Age
45
Location
Croydon, England
Hi

just wondering if anyone has solved the problem in which printing floats to a character string using sprintf, eg:

char pszMyString[25];
sprintf(pszMyString,"Float = %f", 0.5f);
GpTextOut(NULL,&gpDraw[nflip],10,10,(char*)pszMyString,0xe0);

this simply crashes my GP32 and the emu, (but it works with characters + ints).

Thanks.
 
Known issue.. sprintf with floats uses malloc and stuff internally.. unless you have really ported your newlib / libc implementation (i.e. low level io & memory management) things like this break. Either use SDK equivalent gm_sprintf or port the newlib / libc.. :blink:
 
Thanks for the help, but for some reason replacing sprintf with gm_sprintf still crashes... Do I need to do anything else to get it to work?

Thanks,
 
I remember someone talking about removing some flag sent to GCC..
i just can't remember which one..

---
mithris
 
Back
Top