fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <string.h>
  4.  
  5. int main(void)
  6. {
  7. // The number we want to print
  8. int port = 1234;
  9.  
  10. // Copy the raw binary data to a buffer
  11. uint8_t _port[sizeof port];
  12. memcpy(_port, &port, sizeof port);
  13.  
  14. // Skip leading zeroes in the buffer
  15. uint8_t *current;
  16. for (current = _port + sizeof _port - 1; current > _port && *current == 0; --current)
  17. {
  18. // Empty
  19. }
  20.  
  21. // Print the remaining bytes
  22. for (; current >= _port; --current)
  23. {
  24. printf("\\%02x", *current);
  25. }
  26. }
  27.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
\04\d2