Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

char representation of a double

Status
Not open for further replies.

senorbuckwheat

Programmer
Jul 12, 2002
17
0
0
US
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'@'
 
Well, if you mean that you want to access the bytes that make up the representation of the double you can simply do:

char *sDb = (char *)(& nDb);

However the representation is not exactly trivial, if you want more info on that I wrote quite extensively in the following thread:

thread205-316090
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top