wsprintf equivalent

Started by
11 comments, last by ApochPiQ 19 years, 9 months ago
I'm programming a game that uses SDL and I don't want to limit it to the windows platform by using any of the windows only functions. Teh book I'm using uses the function wsprintf, which is defined in windows.h. My question is: Is there a c or C++ function like wsprintf? I know about sprintf, but it doesn't append to the string does it? I wasn't sure about that.
case ShmuelPosted:StupidPosts++;
Advertisement
wsprintf is not a windows-only function, tho it is not a POSIX function. swprintf is more common on UNIX boxes. Note that the only substantial difference between wsprintf and sprintf is that wsprintf uses wide (international) characters.
What include file is it in, because including windows.h included it.
case ShmuelPosted:StupidPosts++;
I have swprintf in wchar.h
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
fruny, do you mean wsprintf?
case ShmuelPosted:StupidPosts++;
No, he means swprintf. It is part of the CRT, which should be with all C compilers.
int sprintf( char *buffer, const char *format [, argument] ... );int swprintf( wchar_t *buffer, const wchar_t *format [, argument] ... );

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

whats the difference between the two?
case ShmuelPosted:StupidPosts++;
swprintf vs wsprintf. Basically, one is portable, the other isn't... plus a few other things.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Where is swprintf defined?
case ShmuelPosted:StupidPosts++;
#include <stdio.h>

main()
{
char str[256];
sprintf(str,"I have owned joo!");
}
HOW DO I MAKE GAMES?READ THIS:http://www.lupinegames.com/articles/path_to_dev.html

This topic is closed to new replies.

Advertisement