method to convert integer to string

M

mthread

Hi,
I would like to know the method to convert integer to string.
Thanx in advance.
 
O

Ondra Holub

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();
}
 
R

red floyd

mthread said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top