Next: What is panic?
From: hirenshah.05@gmail.com on 26 Sep 2005 15:50 i trids itoa, but it is not compiling. so please tell me how to convert integer to string
From: BobR on 26 Sep 2005 17:56 hirenshah.05(a)gmail.com wrote in message <1127764245.658692.61930(a)g47g2000cwa.googlegroups.com>... > i trids itoa, but it is not compiling. so please tell me how to >convert >integer to string > #include <string> // C++ #include <sstream> int main(){ int anum(12345); std::istringstream iss; iss << anum; std::string astr( iss.str() ); return 0; } // main() end alt.comp.lang.learn.c-c++ faq: http://www.comeaucomputing.com/learn/faq/ -- Bob R POVrookie
From: Chris ( Val ) on 26 Sep 2005 18:53 BobR wrote: > hirenshah.05(a)gmail.com wrote in message > <1127764245.658692.61930(a)g47g2000cwa.googlegroups.com>... > > i trids itoa, but it is not compiling. so please tell me how to > >convert > >integer to string > > > > #include <string> // C++ > #include <sstream> > > int main(){ > int anum(12345); > std::istringstream iss; [snip] Oop's :-) std::ostringstream iss; Cheers, Chris Val
From: BobR on 26 Sep 2005 19:39 Chris ( Val ) wrote in message <1127775215.821344.105550(a)z14g2000cwz.googlegroups.com>... > >BobR wrote: >> hirenshah.05(a)gmail.com wrote in message >> <1127764245.658692.61930(a)g47g2000cwa.googlegroups.com>... >> > i trids itoa, but it is not compiling. so please tell me how to >> >convert >> >integer to string >> >> #include <string> // C++ >> #include <sstream> >> int main(){ >> int anum(12345); >> std::istringstream iss; >[snip] > >Oop's :-) > > std::ostringstream iss; > >Cheers, >Chris Val Thanks Chris. Now I gotta go check another post, I probably have him going in the wrong direction too! <G> (... his *is* supposed to be an istringstream.) -- Bob R POVrookie
From: Chris ( Val ) on 26 Sep 2005 21:29
BobR wrote: > Chris ( Val ) wrote in message > <1127775215.821344.105550(a)z14g2000cwz.googlegroups.com>... > > > >BobR wrote: > >> hirenshah.05(a)gmail.com wrote in message > >> <1127764245.658692.61930(a)g47g2000cwa.googlegroups.com>... > >> > i trids itoa, but it is not compiling. so please tell me how to > >> >convert > >> >integer to string > >> > >> #include <string> // C++ > >> #include <sstream> > >> int main(){ > >> int anum(12345); > >> std::istringstream iss; > >[snip] > > > >Oop's :-) > > > > std::ostringstream iss; > > > >Cheers, > >Chris Val > > Thanks Chris. Now I gotta go check another post, I probably have him going > in the wrong direction too! <G> (... his *is* supposed to be an > istringstream.) No worries - I should have changed the identifier too :-) Better make that: std::ostringstream Oss; Cheers, Chris Val |