Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 11th Feb 2015, 07:35 AM   #1
Warrior Member
 
Join Date: 2014
Posts: 10
Thanks: 6
Thanked 28 Times in 23 Posts
Default
Visual c++ help appreciated!!
Share on: 
fb share twitter share gplus share more share

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!
lonewolfmark1 is offline  
Unread 11th Feb 2015, 12:50 PM   #2
Never fear the unknown
War Room Member
 
Vin Venture's Avatar
 
Join Date: 2009
Location: Vancouver, BC
Posts: 225
Thanks: 39
Thanked 33 Times in 30 Posts
Default
Re: Visual c++ help appreciated!!
Share on: 
fb share twitter share gplus share more share

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.
Vin Venture is offline  
Unread 11th Feb 2015, 04:32 PM   #3
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: Visual c++ help appreciated!!
Share on: 
fb share twitter share gplus share more share

Cast it as a char.
KirkMcD is offline  
Closed Thread


Bookmarks

Tags
appreciated, visual


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:17 PM.