How to convert hex to char in C++

1 Answer

0 votes
#include <iostream>
#include <sstream>
 
int main(void)
{
    unsigned int n;   
     
    std::stringstream ss;
     
    ss << std::hex << "61";
     
    ss >> n;
    
    char ch = char(n);
     
    std::cout << ch;
 
    return 0;
}
  
  
  
  
  
/*
run:
  
a
 
*/

 



answered Sep 19, 2021 by avibootz

Related questions

1 answer 231 views
2 answers 443 views
2 answers 221 views
221 views asked Dec 2, 2024 by avibootz
1 answer 202 views
1 answer 256 views
2 answers 236 views
...