fork(1) download
  1. #include <fcntl.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <stddef.h>
  7. #include <sys/types.h>
  8. #include <sys/socket.h>
  9. #include <netinet/in.h>
  10.  
  11. int main(void) {
  12.  
  13. float freq_rang=1.234;
  14. char msg[100] = {0};
  15.  
  16. freq_rang = (float){ntohs(msg[3])};
  17. memcpy(&freq_rang, &(float){ntohs(msg[3])}, 4);
  18.  
  19. printf("%f %02x %02x %02x %02x \n", freq_rang, msg[3],msg[4],msg[5],msg[6]);
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
0.000000 00 00 00 00