How can I convert a hex string to float, and vice-versa.
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Any ideas? ie. "4476976c"-hex is approximately 986.366-float
-
Any ideas? ie. "4476976c"-hex is approximately 986.366-float
I know I'm doing something unnecessary here, but it is sunday morning after all... X|
float a = 986.366; float \*b = &a; // this prints the bytes representing the float in mem for(int i = 0; i < sizeof(float); ++i ) { printf("%2x", \*((unsigned char\*)b+i)); }