double to ascii conversion
-
pls help me in my trouble.i want to convert double value to ascii.can u give code for that?if it is not possible how can i do it? shan
-
pls help me in my trouble.i want to convert double value to ascii.can u give code for that?if it is not possible how can i do it? shan
-
pls help me in my trouble.i want to convert double value to ascii.can u give code for that?if it is not possible how can i do it? shan
%g or %f in sprintf: %f => double Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits. The number of digits before the decimal point depends on the magnitude of the number, and the number of digits after the decimal point depends on the requested precision. %g => double Signed value printed in f or e format, whichever is more compact for the given value and precision. The e format is used only when the exponent of the value is less than –4 or greater than or equal to the precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it. Extract from MSDN doc. ...
-
pls help me in my trouble.i want to convert double value to ascii.can u give code for that?if it is not possible how can i do it? shan
shaans wrote: i want to convert double value to ascii. This makes no sense. With the exception of Unicode, all of the characters, numbers, and symbols you can type are ASCII. There is no such thing as converting from any of those to ASCII. Please explain further what it is that you are attempting to do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
shaans wrote: i want to convert double value to ascii. This makes no sense. With the exception of Unicode, all of the characters, numbers, and symbols you can type are ASCII. There is no such thing as converting from any of those to ASCII. Please explain further what it is that you are attempting to do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
CString sr=m_edit6.Left(3); //ch=sr.GetAt(0); char *t; double dt=::strtod(sr,&t); CString str1; str1.Format("%g",dt); MessageBox(str1); this str1 contains a double value.i want to convert this double value into its ASCII value.plz help mw with this.
-
CString sr=m_edit6.Left(3); //ch=sr.GetAt(0); char *t; double dt=::strtod(sr,&t); CString str1; str1.Format("%g",dt); MessageBox(str1); this str1 contains a double value.i want to convert this double value into its ASCII value.plz help mw with this.
Why the extra step? sr --> dt --> str1 :confused: How about:
str1.Format("%g", (LPCSTR) m_edit6.Left(3));
If you need the intermediate step, why not use
atof()
instead ofstrtod()
? Anonymous wrote: this str1 contains a double value.i want to convert this double value into its ASCII value. Let me see if I have this right. Ifstr1
contains the value 123.45, what exactly is it that you want it converted to? The ASCII value of 1 is 49, 2 is 50, etc. The ASCII value of the decimal is 46. How are you wanting to store these values?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown