To go to a C-string, you'll probably want to just do itos(parm).c_string() -- that's safest. Otherwise you risk buffer overflows, memory being overwritten, and junk. It can be done, though. Just return 'buffer'. Note that the variable goes out-of-scope at the end of the fn and therefore MAY be overwritten, and if you make it static then you have to copy the data elsewhere -- or every time you call the fn, your char* will point to the same address, the data of which will change.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
JS Lemming, you are aware that SDL has an additional library called SDL_TTF (I think that was the name) that is like t3h |_33+ text stuff. It has everything you'd ever want to do with text. What exactly is this text function for?
i was looking at maurador's function i have a different one..
yours uses the buffer and mine uses a string stream. what is the danger of this? and how does sprintf work?
JSL, you're telling me that you're going to go out and make your own text things, when there is a perfectly good text library out there with everything you'd ever need and more ready to use?
There is nothing wrong with SDL_ttf. Maybe that Blitz monstrosity you're used to had a text function that significantly reduced speed/performance, but SDL_ttf isn't going to (even if it did, it'd be a TINY bit). The library has everything you'd ever need for text.
Have you even tried it? Just wondering. If you have post me the code. Really.
And it wasn't like I was making some huge complex text function. All i did was splice a image font then associate each character in the string to a certain tile. Just a matter of converting a char to an int. (int)char!
Show me the code you used to check out all of "SDL_ttf" cool features please.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
I thought you were going out and basically making your own insane SDL_ttf. Actually, no, I've never personally used SDL_ttf. But I will show you what it can do (I have it set up and all). It seriously is really good.