How do i convert an int to a const char?
also, how do i convert a string to a const char?
thanks for all the help.
How do i convert an int to a const char?
also, how do i convert a string to a const char?
thanks for all the help.
int to const char....
int a=12345;
const char c = a &0xff;
string to const char....
string s("some bollux");
const char c = s[0];
I suspect you meant const char* as the above examples although correct will probably be not what you intended.
string to const char* ....
string s("some bollux");
// then when you need the const char* from this you call strings member func c_str().
if (strcmp(s.c_str(),"some bollux")== 0)
{}
int to const char* ....
int a = 12345;
ostringstream os;
os<<a;
string s = a.str();
if (strcmp(s.c_str(),"12345")== 0)
{}
etc.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.