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

method to convert integer to string

P: n/a
Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
Feb 14 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
mthread wrote:
Hi,
I would like to know the method to convert integer to string.
Use a stringstream.

--
Ian Collins.
Feb 14 '08 #2

P: n/a
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

P: n/a
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

P: n/a
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.