Click here to Skip to main content
16,005,236 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Modeless - mosted asked question Pin
Nish Nishant2-May-02 14:03
sitebuilderNish Nishant2-May-02 14:03 
GeneralRe: Modeless - mosted asked question Pin
Stan the man2-May-02 17:30
Stan the man2-May-02 17:30 
GeneralRe: Modeless - mosted asked question Pin
Nish Nishant2-May-02 17:34
sitebuilderNish Nishant2-May-02 17:34 
GeneralRe: Modeless - mosted asked question Pin
Stan the man2-May-02 19:11
Stan the man2-May-02 19:11 
GeneralRe: Modeless - mosted asked question Pin
john john mackey3-May-02 6:07
john john mackey3-May-02 6:07 
GeneralCasting a char array to a double Pin
kyledunn2-May-02 11:15
kyledunn2-May-02 11:15 
GeneralRe: Casting a char array to a double Pin
2-May-02 11:27
suss2-May-02 11:27 
GeneralRe: Casting a char array to a double Pin
mstephens2-May-02 11:46
mstephens2-May-02 11:46 
If you mean you have a double in the first 8 bytes of the array then you can get at it like this:

double dbl = *((double*)cBuffer);

or alternatively if the bytes that contain the double start say 6 bytes into the array then the syntax is nearly the same but you need the address of the first byte of the double:

double dbl = *((double*)&cBuffer[5]);

Just one thing to be careful of is that x86 cpu's allow this casting from anywhere in memory but some cpu's have strict rules about things being aligned on even byte boundaries so if portability is important then you may need to copy the bytes using memcpy() or something first to ensure the proper alignment.

Matt
GeneralRe: Casting a char array to a double Pin
Nish Nishant2-May-02 14:06
sitebuilderNish Nishant2-May-02 14:06 
GeneralRe: Casting a char array to a double Pin
kyledunn2-May-02 15:20
kyledunn2-May-02 15:20 
GeneralRe: Casting a char array to a double Pin
Nish Nishant2-May-02 15:25
sitebuilderNish Nishant2-May-02 15:25 
GeneralRe: Casting a char array to a double Pin
kyledunn2-May-02 15:30
kyledunn2-May-02 15:30 
GeneralSerialization Pin
Steve L.2-May-02 11:10
Steve L.2-May-02 11:10 
GeneralRe: Serialization Pin
Chris Losinger2-May-02 11:11
professionalChris Losinger2-May-02 11:11 
GeneralVirtualProtect. Pin
Mike Doner2-May-02 11:07
Mike Doner2-May-02 11:07 
GeneralDrag-and-Drop doesn't work Pin
Anton A. Loukine2-May-02 10:55
Anton A. Loukine2-May-02 10:55 
GeneralVoIP Pin
2-May-02 10:37
suss2-May-02 10:37 
GeneralRe: VoIP Pin
Michael P Butler2-May-02 10:52
Michael P Butler2-May-02 10:52 
GeneralRe: VoIP Pin
2-May-02 12:08
suss2-May-02 12:08 
GeneralRe: VoIP Pin
2-May-02 12:11
suss2-May-02 12:11 
GeneralRe: VoIP Pin
Michael P Butler2-May-02 22:10
Michael P Butler2-May-02 22:10 
GeneralMobile Phones software Pin
2-May-02 10:24
suss2-May-02 10:24 
GeneralRe: Mobile Phones software Pin
NormDroid2-May-02 10:31
professionalNormDroid2-May-02 10:31 
GeneralRe: Mobile Phones software Pin
2-May-02 10:43
suss2-May-02 10:43 
GeneralRe: Mobile Phones software Pin
Michael P Butler2-May-02 10:49
Michael P Butler2-May-02 10:49 

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.