Hexadecimal to long ieee 754

Hi,

I get from the serial port 4 bytes: 3F 40 00 00 which represents a float ieee 7554 value.

I am trying to display the following:

long iam2 = 0x3F400000;
sprintf(buff, "[0x%X]", iam2);
DisplayPrintStr(buff);

I get [0x0] in arduino and [0x3F400000] in VC++. I guess it is a 16 vs 32 bits issue?

Why can't I store that value in the 32 bits long? What is the workaround?

Mart,

You might try adding an "l" (letter L) modifier to your sprintf format:

sprintf(buff, "[0x%lX]", iam2);

That tells sprintf to treat 'iam2' as a long, rather than an int.

-Mike

ahhh !!

thanx!