| ??? 08/26/08 10:58 Read: times |
#157769 - Here's one without wild casting: Responding to: ???'s previous message |
uint32_t *raw_data;
union
{
uint32_t as_int;
float as_float;
} time;
raw_data = buf; //some large buffer of data
time.as_int = ntohl(*raw_data); //fix the endianness issue
printf("%f\n", time.as_float);
|
| Topic | Author | Date |
| silly C question | 01/01/70 00:00 | |
| *(float*)&time | 01/01/70 00:00 | |
| Thanks!!! | 01/01/70 00:00 | |
| Here's one without wild casting: | 01/01/70 00:00 | |
| Nothing wild | 01/01/70 00:00 | |
| union misuse | 01/01/70 00:00 | |
| Not hiding cast | 01/01/70 00:00 | |
| Programmer knowledge required. | 01/01/70 00:00 | |
| Hiding of portability issue | 01/01/70 00:00 | |
Portability C | 01/01/70 00:00 |



