Visual c++ help appreciated!!

2 replies
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!
#appreciated #visual
  • Profile picture of the author Vin Venture
    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.
    {{ DiscussionBoard.errors[9875756].message }}
  • Profile picture of the author KirkMcD
    Cast it as a char.
    {{ DiscussionBoard.errors[9876278].message }}

Trending Topics