Click here to Skip to main content
15,890,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting double to BYTE array Pin
toxcct22-Dec-05 0:20
toxcct22-Dec-05 0:20 
AnswerRe: Converting double to BYTE array Pin
kakan22-Dec-05 0:51
professionalkakan22-Dec-05 0:51 
GeneralRe: Converting double to BYTE array Pin
toxcct22-Dec-05 0:56
toxcct22-Dec-05 0:56 
GeneralRe: Converting double to BYTE array Pin
kakan22-Dec-05 1:00
professionalkakan22-Dec-05 1:00 
GeneralRe: Converting double to BYTE array Pin
toxcct22-Dec-05 1:02
toxcct22-Dec-05 1:02 
GeneralRe: Converting double to BYTE array Pin
kakan22-Dec-05 1:03
professionalkakan22-Dec-05 1:03 
GeneralRe: Converting double to BYTE array Pin
nde_plume22-Dec-05 6:16
nde_plume22-Dec-05 6:16 
AnswerRe: Converting double to BYTE array Pin
nde_plume22-Dec-05 6:11
nde_plume22-Dec-05 6:11 
Obviously the best wat to do this is to not do it, viz:

union MyConvert
{
double d;
BYTE bytes[sizeof(double)];
};

Thus for some function storeBytes(BYTE*p, size_t size)
to get a double called myVal stored do this:

MyConvert mc;
mc.d = myVal;
storeBytes(mc.bytes, sizeof(myVal);

or if you want to go nuts and save the copy:

storeBytes(((MyConvert*)(&myVal))->bytes, sizeof(myVal));

Though that might not work if the alignment requirements are different between double and unions.

QuestionCString+= Pin
bachirzantou21-Dec-05 23:36
bachirzantou21-Dec-05 23:36 
AnswerRe: CString+= Pin
Sebastian Schneider21-Dec-05 23:49
Sebastian Schneider21-Dec-05 23:49 
AnswerRe: CString+= Pin
Cedric Moonen22-Dec-05 0:00
Cedric Moonen22-Dec-05 0:00 
AnswerRe: CString+= Pin
vikas amin22-Dec-05 0:12
vikas amin22-Dec-05 0:12 
AnswerRe: CString+= Pin
Owner drawn22-Dec-05 0:19
Owner drawn22-Dec-05 0:19 
GeneralRe: CString+= Pin
toxcct22-Dec-05 0:27
toxcct22-Dec-05 0:27 
GeneralRe: CString+= Pin
Owner drawn22-Dec-05 0:30
Owner drawn22-Dec-05 0:30 
GeneralRe: CString+= Pin
toxcct22-Dec-05 0:32
toxcct22-Dec-05 0:32 
GeneralRe: CString+= Pin
ThatsAlok22-Dec-05 1:52
ThatsAlok22-Dec-05 1:52 
GeneralRe: CString+= Pin
toxcct22-Dec-05 2:12
toxcct22-Dec-05 2:12 
General[ot]Re: CString+= Pin
ThatsAlok22-Dec-05 2:17
ThatsAlok22-Dec-05 2:17 
JokeOT- :) Pin
Owner drawn22-Dec-05 17:15
Owner drawn22-Dec-05 17:15 
GeneralRe: OT- :) Pin
ThatsAlok22-Dec-05 17:49
ThatsAlok22-Dec-05 17:49 
GeneralRe: CString+= Pin
Owner drawn22-Dec-05 0:38
Owner drawn22-Dec-05 0:38 
GeneralRe: CString+= Pin
vikas amin22-Dec-05 1:24
vikas amin22-Dec-05 1:24 
AnswerRe: CString+= Pin
toxcct22-Dec-05 0:54
toxcct22-Dec-05 0:54 
AnswerRe: CString+= Pin
kakan22-Dec-05 0:58
professionalkakan22-Dec-05 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.