Conversion from int to basic string
-
Hi Friend, Is there any API which convert int(int a) to basic string(string b)? itoa can convert a(int) to char*(Char *c) and I can get b from c.However is there any other way? Thanks :)
-
Hi Friend, Is there any API which convert int(int a) to basic string(string b)? itoa can convert a(int) to char*(Char *c) and I can get b from c.However is there any other way? Thanks :)
-
I think he was asking how to convert an integer into a std::string directly
-
I think he was asking how to convert an integer into a std::string directly
-
If he do so we can pause him... ;) He is providing C:\> prompt... Just type "pause" command there... :) - NS -
-
hey, don't worry, i'm a pacific intergalactic traveler... my only purpose is to provide C/C++ knowledge around our universe ;)
-
Hi Friend, Is there any API which convert int(int a) to basic string(string b)? itoa can convert a(int) to char*(Char *c) and I can get b from c.However is there any other way? Thanks :)
Here's how I'd go about doing it:
ostringstream ss; ss << "PI = " << 3.14159265; string s = ss.str();
Includes you'll need: <string> <sstream> Assumes:using namespace std;
Steve