Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionON_WM_ENTERIDLE() Pin
susanne119-May-09 22:24
susanne119-May-09 22:24 
AnswerRe: ON_WM_ENTERIDLE() Pin
«_Superman_»19-May-09 22:41
professional«_Superman_»19-May-09 22:41 
GeneralRe: ON_WM_ENTERIDLE() Pin
susanne119-May-09 22:48
susanne119-May-09 22:48 
GeneralRe: ON_WM_ENTERIDLE() Pin
«_Superman_»19-May-09 22:51
professional«_Superman_»19-May-09 22:51 
GeneralRe: ON_WM_ENTERIDLE() Pin
susanne119-May-09 23:24
susanne119-May-09 23:24 
GeneralRe: ON_WM_ENTERIDLE() Pin
«_Superman_»19-May-09 23:38
professional«_Superman_»19-May-09 23:38 
QuestionPerform the conversion from a float decimal number to single precision (4 byte) IEEE 754 format number? Pin
dec8219-May-09 21:58
dec8219-May-09 21:58 
AnswerRe: Perform the conversion from a float decimal number to single precision (4 byte) IEEE 754 format number? Pin
Stuart Dootson19-May-09 22:19
professionalStuart Dootson19-May-09 22:19 
It's converting a float from little-endian form (presuming this code is running on an x86/x64 PC) to big-endian. Let me add comments to your code:

// Declare a union so we can easily access the bytes of a float
typedef union ieee_754_single_precision
{
   BYTE bytes[FLOAT_BYTES]; // Let's hope FLOAT_BYTES == sizeof(float)
   float value;
   IEEE_SBITS bits; // Don't know what this is...
} SIEEE_754;


void cHARTTransmitter::Float2IEEE(float fDecimalNum, BYTE *pbIEEE)
{
   SIEEE_754 local;
   // Set up an index to iterate through the bytes array in local - see my later comment.
   short j = FLOAT_BYTES - 1;
   // Assign the float to the union. The bytes making up the float are now available though local.bytes
   local.value = fDecimalNum;
   
   // Now transfer the bytes from local to pbIEEE, reversing their order 
   // as we do so. It might make it clearer if we replace "j--" by "(FLOAT_BYTES-1)-i"
   // If we look at i and j, we see that
   //
   // pbIEEE[0] = local.bytes[3]; 
   // pbIEEE[1] = local.bytes[2]; 
   // pbIEEE[2] = local.bytes[1]; 
   // pbIEEE[3] = local.bytes[0]; 
   //
   // (BTW - what compiler is this that doesn't require i to be declared?!)
   for (i = 0 ; i < FLOAT_BYTES; i++)
   {
      pbIEEE[i] = local.bytes[j--];
   }
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionHow to insert a Resizing symbol in the bottom right corner of the window Pin
pandit8419-May-09 21:17
pandit8419-May-09 21:17 
AnswerRe: How to insert a Resizing symbol in the bottom right corner of the window Pin
Stuart Dootson19-May-09 22:04
professionalStuart Dootson19-May-09 22:04 
AnswerRe: How to insert a Resizing symbol in the bottom right corner of the window Pin
Hamid_RT20-May-09 0:26
Hamid_RT20-May-09 0:26 
QuestionSetting the drop down size of a Combo Box Pin
V K 219-May-09 18:44
V K 219-May-09 18:44 
AnswerRe: Setting the drop down size of a Combo Box Pin
Chandrasekharan P19-May-09 19:09
Chandrasekharan P19-May-09 19:09 
QuestionAdobe Reader in Java [modified] Pin
snacker219-May-09 15:51
snacker219-May-09 15:51 
AnswerRe: Adobe Reader in Java Pin
Stuart Dootson19-May-09 21:51
professionalStuart Dootson19-May-09 21:51 
GeneralRe: Adobe Reader in Java Pin
snacker220-May-09 5:41
snacker220-May-09 5:41 
GeneralRe: Adobe Reader in Java Pin
Stuart Dootson20-May-09 5:58
professionalStuart Dootson20-May-09 5:58 
GeneralRe: Adobe Reader in Java Pin
snacker220-May-09 6:02
snacker220-May-09 6:02 
GeneralRe: Adobe Reader in Java Pin
snacker220-May-09 10:00
snacker220-May-09 10:00 
GeneralRe: Adobe Reader in Java Pin
snacker220-May-09 10:20
snacker220-May-09 10:20 
GeneralRe: Adobe Reader in Java Pin
snacker221-May-09 3:55
snacker221-May-09 3:55 
GeneralRe: Adobe Reader in Java Pin
snacker220-May-09 6:00
snacker220-May-09 6:00 
Questionnewbie needs help! Pin
jonathan warfield19-May-09 12:49
jonathan warfield19-May-09 12:49 
AnswerRe: newbie needs help! [modified] Pin
Stuart Dootson19-May-09 12:56
professionalStuart Dootson19-May-09 12:56 
AnswerRe: newbie needs help! Pin
Maximilien19-May-09 13:44
Maximilien19-May-09 13:44 

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.