|
-
June 18th, 2008, 06:34 PM
#1
[RESOLVED] Double to Binary Array for IO output
Hey guys, please help me with these functions.
I have this presently working for my Long Int Variables (4 bytes/char's). But I cant for the life of me get this working for Doubles (8 bytes).
I am still rather new to C++.
My Functions:
void DblToBin(long double iVal, unsigned char * vPtr)
{
long i = 0;
unsigned char pChars[8];
memcpy( &pChars[0] ,&iVal, 8);
vPtr=pChars;
return;
}
long double BinToDbl( unsigned char * vPtr)
{
long double iVal = 0;
memcpy( &iVal ,&vPtr[0], 8);
return iVal;
}
The issue:
If I pass a Double Variable in DblToBin and back through BinToDbl the result is always 0, obviously I need this to result as the same as I input.
The Goal:
I am developing a high performance OLAP database and to optimise my load times I am using a fixed length binary File format.
Any help is greatly appreciated.
I am using Bloodshed Dev C++ under Windows XP.
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
|