
converting to different data types
You could use the atof / wtof runtime methods to convert from string to
double, and use the Format() method of the CString class to convert back to
string:
CString sNumber = _T("1.23456");
double d = atof(sNumber);
d = d / 2;
sNumber.Format(_T("%f"), d);
Or, if you need to take locale setup into consideration (handle different
decimal separators) you could go the way via a VARIANT and use
VariantChangeType() / VariantChangeTypeEx() but it's more work.
Arild Bakken
System Developer
---
Inmeta AS - http://www.inmeta.com
Quote:
> Ok. My problem is the same as last time. I am trying to convert CString's
(3
> of them) int to float data types and then back to CString's. Can some one
> please tell how they were able to do this. The reason why I am converting
> them is so that I can use them them in some arithmatic problems.
> Thanx,
> cm