Izzy101
July 9th, 2008, 07:24 PM
Ok so i wanted to test out some code and have a float variable shown on the window. So as far as i can tell there isnt any sort of output besides textout(). (I am fairly new to windows programming btw).
int test = 5;
wsprintf(buffer, L"V: %d", test);
.............
.............
TextOut(hDC, 50, 42, buffer,4);
Okay so this worked, the integer 5 was displayed. So thats great...
Now the entire point was to use a float/double.
float test = 5.1;
wsprintf(buffer, L"V: %f", test); //From what i have seen %f is the syntax
//if it is a float variable
.............
.............
TextOut(hDC, 50, 42, buffer,5);
And this did not work, the output comes out as 'V: %f'.
It does not seem to register the variable i am using.
Does anyone know why this isnt working? Or a better way of doing this?
int test = 5;
wsprintf(buffer, L"V: %d", test);
.............
.............
TextOut(hDC, 50, 42, buffer,4);
Okay so this worked, the integer 5 was displayed. So thats great...
Now the entire point was to use a float/double.
float test = 5.1;
wsprintf(buffer, L"V: %f", test); //From what i have seen %f is the syntax
//if it is a float variable
.............
.............
TextOut(hDC, 50, 42, buffer,5);
And this did not work, the output comes out as 'V: %f'.
It does not seem to register the variable i am using.
Does anyone know why this isnt working? Or a better way of doing this?