day 010 : wsprintf() not printing ???

Hello,

I'm on day 10, trying to print the FPS etc to the console.
Casey is using something like this :
1
2
char buffer[250];
wsprintf(buffer, "FPS : %d \n", fps);


This is not working for me. I have no compile errors, but I'm also not seeing anything in the output console ?!?

I'm using VS2015 on Windows 10.

Anyone knows what's going on?
Thanks !

Edited by siska on
cause it's not pushing things to the console

all it does is put the formatted string in buffer. Which you then need to pass to OutputDebugString
Even when I add this as the last line :
1
OutputDebugStringA(buffer);

I'm not seeing anything ...
Ignore the previous message : restarting VS did the trick, after adding the OutputDebugStringA() line ...

Thank you very much ratchetfreak !
Isn't the wsprintf function for wide chars? If yes, then you are using wsprintf a bit incorrectly.
Wide chars means that your buffer must be with wchar_t type. Also your format string must be wide string, and you must be careful with formatting specifiers (%s is wchar_t string and %S is char). And you need to use OutputDebugStringW function to output it.
So it should look like this:
1
2
3
wchar_t buffer[250];
wsprintf(buffer, L"FPS : %d \n", fps);
OutputDebugStringW(buffer);

Notice the wchar_t and L before the string literal.

Edited by Mārtiņš Možeiko on
no for wide chars output it's wsprintfW

wsprintf is an extended sprintf that can deal with wide character arguments with %ls
Oh, right. That's Windows API function. The actual function he's using is wsprintfA.
I was thinking about swprintf function from stdio.h.