-
Help
I'm trying to get a number from an edit box and multiply it but it, but some numbers when multiplyed return letters, so far what people have suggested doesn't work so heres what i have tryied and the code thats returning the letters.
char buffer[25];
GetWindowText(ebox,buffer,25);
int temp = atoi(buffer) * 2;
itoa(temp,buffer,25);
sprintf("%d",buffer);
SetWindowText(ebox,buffer);
-
-
how about you use a better subject title than "help" and use code tags when you post?!
-
ok i'll use codetage and all that but do you have any ideas how to make this work right, with or without the sprintf it gives me the wrong vales like 6 * 2 = c
-
Code:
char buffer[32];
GetWindowText(hWnd, buffer, sizeof(buffer));
int num = atoi(buffer) * 2;
_snprintf(buffer, sizeof(buffer), "%d", num);
SetWindowText(hWnd, buffer);
-
that works, now how would i make it muliply decimals like 2.5 *2 = 5? or 2.2 * 2 = 4.4? it doesn't do that right now.