Sign in to follow this  
Daivuk

Bug with sprintf()

Recommended Posts

Hi there, I'm trying to code for the GBA (game boy advance) to practice my seft to core coding :P But I have a bug, sprintf dont work. It return that he write 0 caracter.. What I did in my main() :
u16 Temp = 1230;
char strText[31] = "";
s16 Result = sprintf(strText, "Testing %i", Temp );
if (Result < 0) OutputText("Error");
if (Result == 0) OutputText("0 Caracter writed");
OutputText(strText);


My function OutputText(char*) work perfectly, because I can read : "0 Caracter writed" But I cant see "Testing" on the final OutputText because sprintf just dont work.. What can be the prob? Something to do with the gba? Because I see a guy using sprintf in his gba programme, and it work for him. Thanks

Share this post


Link to post
Share on other sites
hum... I declare this in the main :

u16 Map[512*512] = {0};

And if I comment it, sprintf work :S
Some ram trouble in the gba?

Share this post


Link to post
Share on other sites
Quote:
Original post by Daivuk
hum... I declare this in the main :

u16 Map[512*512] = {0};

And if I comment it, sprintf work :S
Some ram trouble in the gba?
Let's see, 512*512*2 = 512 kB. There's just no way that'll fit in 32 kB of IWRAM (or even in 256 kB of EWRAM, if you have a weird linker script).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this