By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

convert char to string

P: n/a
Hello I need to convert a chat to a string... but I don't know how to do
this. i;ve searched the internet but I've only find some code to convert
char * to string or char [] to string....

but I just need char to string.

Anyone knows how to do this ?

thanks!!!!
Sep 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Joah Senegal wrote:
Hello I need to convert a chat to a string... but I don't know how to
do this. i;ve searched the internet but I've only find some code to
convert char * to string or char [] to string....

but I just need char to string.

Anyone knows how to do this ?
char c('A');
std::string s(1, c); // s now has "A"

or

char c('A');
std::string s(&c, 1); // s now has "A"

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 25 '06 #2

P: n/a
"Victor Bazarov" <v.********@comAcast.netwrote in message
news:ef**********@news.datemas.de...
Joah Senegal wrote:
>Hello I need to convert a chat to a string... but I don't know how to
do this. i;ve searched the internet but I've only find some code to
convert char * to string or char [] to string....

but I just need char to string.

Anyone knows how to do this ?

char c('A');
std::string s(1, c); // s now has "A"

or

char c('A');
std::string s(&c, 1); // s now has "A"

V
Or

char c('A');
std::string s;
s = s + c;

s now has "A"
Sep 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.