edit control - testing input
Hi, I've made MFC application that performs calculations with numbers entered from edit controls.
For example:
Code:
...
CString var1,var2;
double var1double,var2double;
...
GetDlgItem(IDC_FS)->GetWindowText(var1);
GetDlgItem(IDC_VF)->GetWindowText(var_2);
var1double=atof(var1);
var2double=atof(var2);
...
Problem arises when user enters some characters or string
when he's supposed to enter number.
For example value 5.52 is expected and user enters "dfsd". Function atof() will work and I'll get some dummy values in further calculations.
My question is how to check if value that is entered (in form string) really number or not?
Is there any way to check what is entered and to notify user to try again if number is not enetered.
Thanks for help!