Connecting Tech Pros Worldwide Forums | Help | Site Map

convert char to string

Joah Senegal
Guest
 
Posts: n/a
#1: Sep 25 '06
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!!!!



Victor Bazarov
Guest
 
Posts: n/a
#2: Sep 25 '06

re: convert char to string


Joah Senegal wrote:
Quote:
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


Jim Langston
Guest
 
Posts: n/a
#3: Sep 25 '06

re: convert char to string


"Victor Bazarov" <v.Abazarov@comAcast.netwrote in message
news:ef8kau$fkk$1@news.datemas.de...
Quote:
Joah Senegal wrote:
Quote:
>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"


Closed Thread