float f=0;memmove(&f, buffer, min( sizeof(f),N ) );
const char *s = "296f4e41";union { int i; float f;} u;int i;sscanf(s, "%8x", &u.i);printf("%f", u.f);
#include <stdio.h>char buff[8] = {50, 57, 54, 70, 52, 69, 52, 49};#define conv(a) ((((a) >= '0') && ((a) <= '9')) ? ((a) - '0') : \ ((((a) >= 'a') && ((a) <= 'f')) ? ((a) - 0x57) : \ ((((a) >= 'A') && ((a) <= 'F')) ? ((a) - 0x37) : -1)))int main(int argc, char* argv[]){ union { char rbuff[4]; float f; } u; u.rbuff[0] = (conv(buff[0]) << 4) | conv(buff[1]); u.rbuff[1] = (conv(buff[2]) << 4) | conv(buff[3]); u.rbuff[2] = (conv(buff[4]) << 4) | conv(buff[5]); u.rbuff[3] = (conv(buff[6]) << 4) | conv(buff[7]); printf("%f\n", u.f); return 0;}
const char *s = "296f4e41";union { unsigned char c[4]; float f;} u;sscanf(s, "%2x%2x%2x%2x", &u.c[0], &u.c[1], &u.c[2], &u.c[3]);printf("%f", u.f);