|
-
June 3rd, 1999, 02:54 PM
#1
CString Conversions
Hi,
Can someone please show me the best way to convert a CString variable which is a string number to a real number, say a double, do some math, say times it by two, and covert the result back to a CString?
Steve Palmer
-
June 3rd, 1999, 03:07 PM
#2
Re: CString Conversions
Remember that CString has a (const char *) operator and most of the string
conversion functions take a ccp as an argument. Also remember that CString
has a Format member that supports the same specifiers as sprintf.
CString svalue = "3.141596";
double dvalue = atof( svalue );
double dresult = dvalue * 2.0;
CString answer;
answer.Format( "result is %.3f", dresult );
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|