fork(2) download
  1. #include <stdio.h>
  2. #if defined(__linux__)
  3. # include <endian.h>
  4. #elif defined(__FreeBSD__) || defined(__NetBSD__)
  5. # include <sys/endian.h>
  6. #elif defined(__OpenBSD__)
  7. # include <sys/types.h>
  8. # define be16toh(x) betoh16(x)
  9. # define be32toh(x) betoh32(x)
  10. # define be64toh(x) betoh64(x)
  11. #endif
  12.  
  13. int main(){
  14. char buffer[8] = {0x40, 0x69, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00};
  15. double data = *((double*)buffer);
  16. printf("%lf , %lf\n", data, be64toh(data));
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
0.000000 , 0.000000