471,853 Members | 831 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

method to convert integer to string

Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
Feb 14 '08 #1
4 2080
mthread wrote:
Hi,
I would like to know the method to convert integer to string.
Use a stringstream.

--
Ian Collins.
Feb 14 '08 #2
On 14 Ún, 08:22, mthread <rjk...@gmail.comwrote:
Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
#include <string>
#include <sstream>

// Fn should return true if conversion succeeded
template<typename INT>
bool ToInt(const std::string& s, INT& i)
{
std::istringstream iss(s);
s >i;
return !iss.bad();
}
Feb 14 '08 #3
mthread wrote:
Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
I heard about this great new tool on the web that lets you search for stuff.

It's called "Google". You really should try it.
Feb 14 '08 #4
mthread wrote:
Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
This is how:

http://austria.svn.sourceforge.net/v...=1&view=markup

I think the c.l.c++ faq lite has some more info.
Feb 14 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Jeff Wagner | last post: by
5 posts views Thread by IamZadok | last post: by
4 posts views Thread by Lerp | last post: by
8 posts views Thread by Carlos | last post: by
5 posts views Thread by Mika M | last post: by
14 posts views Thread by Drew | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.