i wasn't using chars anymore as of now but i'm thinking if i need decimals i'm going to have to. even tho GetDlgItemInt is just so much easier, lol *dammit*
but yea - typecasted or not, it still outputs 99 to the screen and 100.000000 to the text file. here's my function so far:
Code:
void Calculate(HWND hwnd, double input)
{
FILE *fileptr;
fileptr = fopen("output.txt", "wb");
if (fileptr == NULL) MessageBox(hwnd, "there was an error creating the file.",
"error", MB_OK | MB_ICONERROR);
if (type_of_conversion == 1)
{
input = fiveninths * (input - 32.0);
fprintf(fileptr, "FtoC result: %f\n", input);
SetDlgItemInt(hwnd, ID_LABEL5, (int)input, FALSE);
fclose(fileptr);
}
}
also - should the last parameter of the SetDlgItemInt be TRUE or FALSE? thanks
//edit - this is curious. the fraction 5/9 = .55555... and 9/5 = 1.8000... but when put into the function, produce different results. with the code as it is above, it displays 99 on the screen. but if the math changes to:
input = (input - 32.0) / ninefifths; then the displayed result on the screen is 100.
*doesn't really get it* whatever.
i'm still looking to get decimals because you can't really convert a temperature when the only way to do it is with whole degrees. its just not accurate.
thanks