Jump to content
  • Advertisement
Sign in to follow this  
Daivuk

Bug with sprintf()

This topic is 4970 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
ok, thats why.
I put my map in const in a .h
Like this its include in the ROM file, that can be 9 Mb ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!