char representation of a double
-
Hi, I am looking for a way to convert a double to the char representation, ie. put double, which is eight bytes, to char[8]; Example: double nDb = 12.34; char szDb[8]; szdB would hold the character representation of nDb which might look something like: [0] 0'' [1] 0'' [2] 0'' [3] 0'' [4] 0'' [5] 0'' [6] 51'3' [7] 64'@' Thank you.
-
Hi, I am looking for a way to convert a double to the char representation, ie. put double, which is eight bytes, to char[8]; Example: double nDb = 12.34; char szDb[8]; szdB would hold the character representation of nDb which might look something like: [0] 0'' [1] 0'' [2] 0'' [3] 0'' [4] 0'' [5] 0'' [6] 51'3' [7] 64'@' Thank you.
For native or managed code? Something like the following would do the trick: (in native code) memcpy(szDb, &nDb, 8); (with a managed array) char __pin* temp = &szDb[0]; memcpy(temp, &nDb, 8); This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2001 Microsoft Corporation. All rights reserved.