fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. int i = 1234567890;
  7. unsigned char hex[] = {
  8. (i >> 24) & 0xFF
  9. , (i >> 16) & 0xFF
  10. , (i >> 8) & 0xFF
  11. , (i >> 0) & 0xFF
  12. , 0 // Null terminator to match your C string
  13. };
  14. for (int j = 0 ; j != 4 ; j++) {
  15. cout << std::hex << setfill('0') << setw(2) << (int)hex[j] << " ";
  16. }
  17. cout << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
49 96 02 d2