I want to display the fps for my app. heres part of my code:
I cant make it 4 fields but i cant get the length of a int so what do you do for this ?Code:case WM_PAINT:
TextOut(hDC,1,1,fcount,lstrlen(fcount)); //fcount = int
Printable View
I want to display the fps for my app. heres part of my code:
I cant make it 4 fields but i cant get the length of a int so what do you do for this ?Code:case WM_PAINT:
TextOut(hDC,1,1,fcount,lstrlen(fcount)); //fcount = int
Use sprintf to convert the int to a string
Code:char buff[20];
sprintf( buff, "%d", fcount );
TextOut(hDC,1,1,buff,lstrlen(buff));
i tried that but the compiler said sprintf was a undeclared identitifier ?
Make sure that you include iostream.h
You want to include <stdio.h> to use sprintf
I suggest dont use Sprintf() use the atoi(); or itoa() for conversions.
it has more options if you are using MSVC++...
also look at _atio() and _itoa() in the MSDN library