Visual c++ help appreciated!!

by 2 replies
3
I am using Visual Studio using c++.

I have a char which holds a value. I need to add the value to a text box, so I have:

char x;
textBox2->Text = x.ToString();

Trouble is I need to get the ASCII value instead of the decimal.

i.e. if x has 117 in it I want to get 'u' in the string, at the moment I get 117.

Any easy way to do this!

Really appreciate any help!
#programming #appreciated #visual
  • C++ doesn't have a universal toString() method like Java. Though since you're trying to convert a character array to a string, why not simply use the built in string primitive?

    #include <string>
    std::string x = "117";

    I'm not really sure what you mean when you say you want to get 'u' in the string... some clarification would help.
  • Cast it as a char.

Next Topics on Trending Feed