fork(9) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. inline unsigned int to_uint(char ch)
  6. {
  7. return static_cast<unsigned int>(static_cast<unsigned char>(ch));
  8. }
  9.  
  10. int main()
  11. {
  12. string data{"Hello"};
  13.  
  14. cout << hex;
  15. for (char ch : data)
  16. {
  17. cout << "0x" << to_uint(ch) << ' ';
  18. }
  19. }
  20.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
0x48 0x65 0x6c 0x6c 0x6f