I have a simple encoding program, and want to add some unicode characters. I'm doing some math, then converting the decimal value to hex, then to Unicode. The problem is that the conversion from decimal to hex, gives me a string, and that I don't know a way to convert a string to a char (not char[]).
how can I convert a Decimal Number to its Unicode character (char) equivalent with out creating a string?
Here's some code where I was trying to figure it out, we've established this wont work:
#include <iostream>
#include <sstream>
using namespace std;
int main(){
int decimal_value = 1111;
stringstream ss;
ss<< hex << decimal_value; // int decimal_value
string res ( ss.str() );
std::ostringstream oss;
oss << "\\u0" << res;
string var = oss.str();
cout << var << "\n" << "\u0457" << "\n";
return 0;
}
output:
\u0457
ї