_wtof überprüfen
-
Ich möchte einen CString zu einem double konvertieren, bis jetzt mache ich das ganze mit _wtof(CString), kann ich irgendwie überprüfen ob tatsächlich eine Zahl eingegeben wurde?
mfg, Johannes
-
MSDN hat mir gerade Folgendes ins Ohr geflüstert:
The return value is 0 (for atoi, _atoi64, _wtoi, and _wtoi64), 0L (for atol and _wtol), or 0.0 (for atof and _wtof) if the input cannot be converted to a value of that type.
Das bedeutet für dich:
if (_wtof(CString) != 0) cout << "yay!";Grüße,
Rewind.